{"action":"closed","issue":{"url":"https://api.github.com/repos/espruino/Espruino/issues/989","repository_url":"https://api.github.com/repos/espruino/Espruino","labels_url":"https://api.github.com/repos/espruino/Espruino/issues/989/labels{/name}","comments_url":"https://api.github.com/repos/espruino/Espruino/issues/989/comments","events_url":"https://api.github.com/repos/espruino/Espruino/issues/989/events","html_url":"https://github.com/espruino/Espruino/issues/989","id":193833555,"number":989,"title":"Parsing issue with return and promises","user":{"login":"gfwilliams","id":754445,"avatar_url":"https://avatars.githubusercontent.com/u/754445?v=3","gravatar_id":"","url":"https://api.github.com/users/gfwilliams","html_url":"https://github.com/gfwilliams","followers_url":"https://api.github.com/users/gfwilliams/followers","following_url":"https://api.github.com/users/gfwilliams/following{/other_user}","gists_url":"https://api.github.com/users/gfwilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/gfwilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfwilliams/subscriptions","organizations_url":"https://api.github.com/users/gfwilliams/orgs","repos_url":"https://api.github.com/users/gfwilliams/repos","events_url":"https://api.github.com/users/gfwilliams/events{/privacy}","received_events_url":"https://api.github.com/users/gfwilliams/received_events","type":"User","site_admin":false},"labels":[{"id":60259029,"url":"https://api.github.com/repos/espruino/Espruino/labels/high%20priority","name":"high priority","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-06T17:24:26Z","updated_at":"2016-12-15T12:08:31Z","closed_at":"2016-12-15T12:08:31Z","body":"On Puck.js the following code works fine, but fails with:\r\n\r\n```\r\nUncaught SyntaxError: Got catch expected ID\r\n at line 9 col 6\r\n  }).catch(function() {\r\n     ^\r\nin function called from system\r\n```\r\n\r\nwhen called in quick succession (eg. busy==true so returned)\r\n\r\n```\r\nvar busy = false;\r\nfunction sendToggle() {\r\n  if (busy) return;\r\n  busy = true;\r\n  digitalPulse(LED3, 1, 500); // light blue to show we're working\r\n  NRF.requestDevice({ filters: [{ name: 'Puck.js 7fcf' }] }).then(function(device) {\r\n    require(\"ble_simple_uart\").write(device, \"toggle()\\n\", function() {\r\n      digitalPulse(LED2, 1, 500); // light green to show it worked\r\n      busy = false;\r\n    });\r\n  }).catch(function() {\r\n    digitalPulse(LED1, 1, 500); // light red if we had a problem\r\n    busy = false;\r\n  });\r\n}\r\nsetWatch(sendToggle, BTN, { edge:\"rising\", debounce:50, repeat: true });\r\n```"}}
{"actor":{"display_login":"gfwilliams"}}