{"action":"created","issue":{"url":"https://api.github.com/repos/hapijs/hapi/issues/2375","labels_url":"https://api.github.com/repos/hapijs/hapi/issues/2375/labels{/name}","comments_url":"https://api.github.com/repos/hapijs/hapi/issues/2375/comments","events_url":"https://api.github.com/repos/hapijs/hapi/issues/2375/events","html_url":"https://github.com/hapijs/hapi/issues/2375","id":55603992,"number":2375,"title":"Thrown errors which are not Error objects","user":{"login":"gagle","id":1446052,"avatar_url":"https://avatars.githubusercontent.com/u/1446052?v=3","gravatar_id":"","url":"https://api.github.com/users/gagle","html_url":"https://github.com/gagle","followers_url":"https://api.github.com/users/gagle/followers","following_url":"https://api.github.com/users/gagle/following{/other_user}","gists_url":"https://api.github.com/users/gagle/gists{/gist_id}","starred_url":"https://api.github.com/users/gagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagle/subscriptions","organizations_url":"https://api.github.com/users/gagle/orgs","repos_url":"https://api.github.com/users/gagle/repos","events_url":"https://api.github.com/users/gagle/events{/privacy}","received_events_url":"https://api.github.com/users/gagle/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hapijs/hapi/labels/non-issue","name":"non-issue","color":"c7def8"}],"state":"closed","locked":false,"assignee":{"login":"hueniverse","id":56631,"avatar_url":"https://avatars.githubusercontent.com/u/56631?v=3","gravatar_id":"","url":"https://api.github.com/users/hueniverse","html_url":"https://github.com/hueniverse","followers_url":"https://api.github.com/users/hueniverse/followers","following_url":"https://api.github.com/users/hueniverse/following{/other_user}","gists_url":"https://api.github.com/users/hueniverse/gists{/gist_id}","starred_url":"https://api.github.com/users/hueniverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hueniverse/subscriptions","organizations_url":"https://api.github.com/users/hueniverse/orgs","repos_url":"https://api.github.com/users/hueniverse/repos","events_url":"https://api.github.com/users/hueniverse/events{/privacy}","received_events_url":"https://api.github.com/users/hueniverse/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-01-27T11:05:35Z","updated_at":"2015-02-04T08:44:42Z","closed_at":"2015-02-04T07:37:32Z","body":"If you throw an error like `throw 123` inside a route handler, the `event.data` Error object which you receive listening to the `request-internal` event does not contain the thrown error in its message, the `event.data.message` is just `Uncaught error`. If you throw an Error object, `throw new Error(123)`, the `event.data.message` is `Uncaught error: 123`.\r\n\r\nCan you handle this use case?\r\n\r\n```javascript\r\nserver.on('request-internal', function (request, event, tags) {\r\n  if (tags.error && event.data instanceof Error) {\r\n    if (event.data.data){\r\n      // Thrown errors which are not Error objects\r\n      event.data.message += ': ' + event.data.data;\r\n    }\r\n    print(event.data.stack);\r\n  }\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/hapijs/hapi/issues/comments/72810451","html_url":"https://github.com/hapijs/hapi/issues/2375#issuecomment-72810451","issue_url":"https://api.github.com/repos/hapijs/hapi/issues/2375","id":72810451,"user":{"login":"gagle","id":1446052,"avatar_url":"https://avatars.githubusercontent.com/u/1446052?v=3","gravatar_id":"","url":"https://api.github.com/users/gagle","html_url":"https://github.com/gagle","followers_url":"https://api.github.com/users/gagle/followers","following_url":"https://api.github.com/users/gagle/following{/other_user}","gists_url":"https://api.github.com/users/gagle/gists{/gist_id}","starred_url":"https://api.github.com/users/gagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagle/subscriptions","organizations_url":"https://api.github.com/users/gagle/orgs","repos_url":"https://api.github.com/users/gagle/repos","events_url":"https://api.github.com/users/gagle/events{/privacy}","received_events_url":"https://api.github.com/users/gagle/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T08:44:42Z","updated_at":"2015-02-04T08:44:42Z","body":"I'm just asking to treat this use case, third party libraries could throw things that you don't have control over them."}}