{"action":"closed","issue":{"url":"https://api.github.com/repos/addyosmani/critical/issues/133","repository_url":"https://api.github.com/repos/addyosmani/critical","labels_url":"https://api.github.com/repos/addyosmani/critical/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/addyosmani/critical/issues/133/comments","events_url":"https://api.github.com/repos/addyosmani/critical/issues/133/events","html_url":"https://github.com/addyosmani/critical/issues/133","id":152872222,"number":133,"title":"log errors in uncaughtException handler","user":{"login":"thadeetrompetter","id":5120227,"avatar_url":"https://avatars.githubusercontent.com/u/5120227?v=3","gravatar_id":"","url":"https://api.github.com/users/thadeetrompetter","html_url":"https://github.com/thadeetrompetter","followers_url":"https://api.github.com/users/thadeetrompetter/followers","following_url":"https://api.github.com/users/thadeetrompetter/following{/other_user}","gists_url":"https://api.github.com/users/thadeetrompetter/gists{/gist_id}","starred_url":"https://api.github.com/users/thadeetrompetter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thadeetrompetter/subscriptions","organizations_url":"https://api.github.com/users/thadeetrompetter/orgs","repos_url":"https://api.github.com/users/thadeetrompetter/repos","events_url":"https://api.github.com/users/thadeetrompetter/events{/privacy}","received_events_url":"https://api.github.com/users/thadeetrompetter/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-03T20:55:36Z","updated_at":"2016-05-03T21:16:34Z","closed_at":"2016-05-03T21:16:34Z","body":"Errors are apparently being swallowed after requiring `critical`.\r\n\r\n```javascript\r\nthrow new Error('foo'); // error is thrown to console\r\nvar critical = require('critical');\r\n```\r\n\r\n```javascript\r\nvar critical = require('critical');\r\nthrow new Error('bar'); // error is not thrown\r\n```\r\n\r\nThis happens because `lib/gc.js` attaches an **unhandledException** handler to\r\n**process**. `onException` exits with code 99, but does not log the error.\r\n\r\nIf an error is thrown somewhere in your script after having included critical\r\n(e.g. in some other build task), you won't get to see it.\r\n\r\n`onException` in `lib/gc.js` should log the error before calling\r\n`process.exit`."}}