{"action":"created","issue":{"url":"https://api.github.com/repos/neo4j/neo4j-javascript-driver/issues/86","repository_url":"https://api.github.com/repos/neo4j/neo4j-javascript-driver","labels_url":"https://api.github.com/repos/neo4j/neo4j-javascript-driver/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/neo4j/neo4j-javascript-driver/issues/86/comments","events_url":"https://api.github.com/repos/neo4j/neo4j-javascript-driver/issues/86/events","html_url":"https://github.com/neo4j/neo4j-javascript-driver/issues/86","id":160837230,"number":86,"title":"Promises swallowing syntax/runtime errors","user":{"login":"legraphista","id":962643,"avatar_url":"https://avatars.githubusercontent.com/u/962643?v=3","gravatar_id":"","url":"https://api.github.com/users/legraphista","html_url":"https://github.com/legraphista","followers_url":"https://api.github.com/users/legraphista/followers","following_url":"https://api.github.com/users/legraphista/following{/other_user}","gists_url":"https://api.github.com/users/legraphista/gists{/gist_id}","starred_url":"https://api.github.com/users/legraphista/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/legraphista/subscriptions","organizations_url":"https://api.github.com/users/legraphista/orgs","repos_url":"https://api.github.com/users/legraphista/repos","events_url":"https://api.github.com/users/legraphista/events{/privacy}","received_events_url":"https://api.github.com/users/legraphista/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-17T08:29:15Z","updated_at":"2016-06-17T08:35:39Z","closed_at":"2016-06-17T08:35:39Z","body":"Hey there,\r\nI just noticed that the following code will throw but will swallow and not bubble up the error:\r\n```javascript\r\nconst session = driver.session();\r\nsession\r\n    .run('return 1 as value')\r\n    .catch(console.error)\r\n    .then((data) => {\r\n        if (data.records[0].get('value') % 2) {\r\n            throw new Error('How odd!');\r\n        }\r\n\r\n        console.log('My awesome value is', data.records[0].get('value').toNumber())\r\n    }, console.error);\r\n```\r\nand thus nothing will be displayed on the screen.\r\n\r\nBut when using `subscribe`, the errors are properly surfaced:\r\n```javascript\r\nconst session = driver.session();\r\n\r\nsession\r\n    .run('return 1 as value')\r\n    .subscribe({\r\n        onError: console.error,\r\n        onNext: (row) => {\r\n            if (row.get('value') % 2) {\r\n                throw new Error('How odd!');\r\n            }\r\n\r\n            console.log('My awesome value is', row.get('value').toNumber())\r\n        },\r\n        onCompleted: () => {\r\n            console.log('I\\'m done!');\r\n            throw new Error('You should have closed the session dude 😱')\r\n        }\r\n    });\r\n``` \r\nBoth errors in `onNext` and `onCompleted` are surfaced.\r\n\r\nAm I missing something here or is this _intended_ behaviour?"},"comment":{"url":"https://api.github.com/repos/neo4j/neo4j-javascript-driver/issues/comments/226712755","html_url":"https://github.com/neo4j/neo4j-javascript-driver/issues/86#issuecomment-226712755","issue_url":"https://api.github.com/repos/neo4j/neo4j-javascript-driver/issues/86","id":226712755,"user":{"login":"legraphista","id":962643,"avatar_url":"https://avatars.githubusercontent.com/u/962643?v=3","gravatar_id":"","url":"https://api.github.com/users/legraphista","html_url":"https://github.com/legraphista","followers_url":"https://api.github.com/users/legraphista/followers","following_url":"https://api.github.com/users/legraphista/following{/other_user}","gists_url":"https://api.github.com/users/legraphista/gists{/gist_id}","starred_url":"https://api.github.com/users/legraphista/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/legraphista/subscriptions","organizations_url":"https://api.github.com/users/legraphista/orgs","repos_url":"https://api.github.com/users/legraphista/repos","events_url":"https://api.github.com/users/legraphista/events{/privacy}","received_events_url":"https://api.github.com/users/legraphista/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T08:35:39Z","updated_at":"2016-06-17T08:35:39Z","body":"Never-mind, `catch` should be after `then`"}}
{"actor":{"display_login":"legraphista"}}