{"action":"created","issue":{"url":"https://api.github.com/repos/webdriverio/webdriverio/issues/827","labels_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/827/labels{/name}","comments_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/827/comments","events_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/827/events","html_url":"https://github.com/webdriverio/webdriverio/issues/827","id":111200981,"number":827,"title":"client.on('error') not being called","user":{"login":"benjyblack","id":2996302,"avatar_url":"https://avatars.githubusercontent.com/u/2996302?v=3","gravatar_id":"","url":"https://api.github.com/users/benjyblack","html_url":"https://github.com/benjyblack","followers_url":"https://api.github.com/users/benjyblack/followers","following_url":"https://api.github.com/users/benjyblack/following{/other_user}","gists_url":"https://api.github.com/users/benjyblack/gists{/gist_id}","starred_url":"https://api.github.com/users/benjyblack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjyblack/subscriptions","organizations_url":"https://api.github.com/users/benjyblack/orgs","repos_url":"https://api.github.com/users/benjyblack/repos","events_url":"https://api.github.com/users/benjyblack/events{/privacy}","received_events_url":"https://api.github.com/users/benjyblack/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/webdriverio/webdriverio/labels/Bug","name":"Bug","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/webdriverio/webdriverio/milestones/2","html_url":"https://github.com/webdriverio/webdriverio/milestones/Upcoming","labels_url":"https://api.github.com/repos/webdriverio/webdriverio/milestones/2/labels","id":1138980,"number":2,"title":"Upcoming","description":"Features or issues that are not blocked and reasonable to work on.","creator":{"login":"christian-bromann","id":731337,"avatar_url":"https://avatars.githubusercontent.com/u/731337?v=3","gravatar_id":"","url":"https://api.github.com/users/christian-bromann","html_url":"https://github.com/christian-bromann","followers_url":"https://api.github.com/users/christian-bromann/followers","following_url":"https://api.github.com/users/christian-bromann/following{/other_user}","gists_url":"https://api.github.com/users/christian-bromann/gists{/gist_id}","starred_url":"https://api.github.com/users/christian-bromann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christian-bromann/subscriptions","organizations_url":"https://api.github.com/users/christian-bromann/orgs","repos_url":"https://api.github.com/users/christian-bromann/repos","events_url":"https://api.github.com/users/christian-bromann/events{/privacy}","received_events_url":"https://api.github.com/users/christian-bromann/received_events","type":"User","site_admin":false},"open_issues":25,"closed_issues":42,"state":"open","created_at":"2015-05-29T00:45:55Z","updated_at":"2015-10-13T15:58:39Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-10-13T15:09:26Z","updated_at":"2015-10-13T17:15:49Z","closed_at":null,"body":"According to [this document](http://webdriver.io/guide/usage/eventhandling.html) the `client.on('error')` hook should be called whenever an error occurs. Using version 3.2.5 of webdriverio I'm unable get the listener callback to fire:\r\n\r\n```js\r\n// set up global error handler\r\nclient.on('error', function (err) {\r\n  console.log('Global error handler called');\r\n});\r\n\r\nclient\r\n.url('http://google.com')\r\n.click('#non-existing-element')\r\n.catch(function (err) {\r\n  console.log('Local catch called');\r\n});\r\n\r\n// outputs >> 'Local catch called'\r\n// does NOT output >> 'Global error handler called'\r\n```"},"comment":{"url":"https://api.github.com/repos/webdriverio/webdriverio/issues/comments/147781806","html_url":"https://github.com/webdriverio/webdriverio/issues/827#issuecomment-147781806","issue_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/827","id":147781806,"user":{"login":"benjyblack","id":2996302,"avatar_url":"https://avatars.githubusercontent.com/u/2996302?v=3","gravatar_id":"","url":"https://api.github.com/users/benjyblack","html_url":"https://github.com/benjyblack","followers_url":"https://api.github.com/users/benjyblack/followers","following_url":"https://api.github.com/users/benjyblack/following{/other_user}","gists_url":"https://api.github.com/users/benjyblack/gists{/gist_id}","starred_url":"https://api.github.com/users/benjyblack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjyblack/subscriptions","organizations_url":"https://api.github.com/users/benjyblack/orgs","repos_url":"https://api.github.com/users/benjyblack/repos","events_url":"https://api.github.com/users/benjyblack/events{/privacy}","received_events_url":"https://api.github.com/users/benjyblack/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T17:15:49Z","updated_at":"2015-10-13T17:15:49Z","body":"Have also noticed some other odd error handling behavior, and this happens in webdriver v3.1.0 as well. I can't seem to get `.on('error')` to fire when throwing an error from a custom command:\r\n\r\n```js\r\n// set up global error handler\r\nclient.on('error', function (err) {\r\n  console.log('Global error handler called');\r\n});\r\n\r\nclient.addCommand('throwError', function () {\r\n  throw new Error('Custom command error');\r\n});\r\n\r\nclient\r\n.throwError()\r\n.catch(function (err) {\r\n  console.log('Local catch called');\r\n});\r\n\r\n// outputs >> 'Local catch called'\r\n// does NOT output >> 'Global error handler called'\r\n```\r\n\r\nWould you like me to open another issue regarding `.on('error')` handling errors thrown from custom commands?"}}