{"_id":"hard-rejection","_rev":"2586","name":"hard-rejection","description":"Make unhandled promise rejections fail hard right away instead of the default silent fail","dist-tags":{"latest":"2.1.0"},"maintainers":[{"name":"npm:sindresorhus","email":""},{"name":"sindresorhus","email":""}],"time":{"modified":"2021-06-03T09:56:10.000Z","created":"2016-08-27T20:11:13.702Z","2.1.0":"2019-04-02T02:45:26.609Z","2.0.0":"2019-03-17T12:53:50.619Z","1.0.0":"2017-01-13T10:18:47.437Z","0.1.0":"2016-08-27T20:11:13.702Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/hard-rejection.git"},"versions":{"2.1.0":{"name":"hard-rejection","version":"2.1.0","description":"Make unhandled promise rejections fail hard right away instead of the default silent fail","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/hard-rejection.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","promises","unhandled","uncaught","rejection","hard","fail","catch","throw","handler","exit","debug","debugging","verbose","immediate","immediately"],"devDependencies":{"ava":"^1.4.1","execa":"^1.0.0","tsd":"^0.7.1","xo":"^0.24.0"},"gitHead":"71300d4b742f2cee0f926f4ad3459b66c88d610f","bugs":{"url":"https://github.com/sindresorhus/hard-rejection/issues"},"homepage":"https://github.com/sindresorhus/hard-rejection#readme","_id":"hard-rejection@2.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"1c6eda5c1685c63942766d79bb40ae773cecd883","size":2485,"noattachment":false,"key":"/hard-rejection/-/hard-rejection-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hard-rejection/download/hard-rejection-2.1.0.tgz"},"maintainers":[{"name":"npm:sindresorhus","email":""},{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hard-rejection_2.1.0_1554173126513_0.9019311825096288"},"_hasShrinkwrap":false,"publish_time":1554173126609,"_cnpm_publish_time":1554173126609},"2.0.0":{"name":"hard-rejection","version":"2.0.0","description":"Make unhandled promise rejections fail hard right away instead of the default silent fail","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/hard-rejection.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd-check"},"keywords":["promise","promises","unhandled","uncaught","rejection","hard","fail","catch","throw","handler","exit","debug","debugging","verbose","immediate","immediately"],"devDependencies":{"ava":"^1.3.1","execa":"^1.0.0","tsd-check":"^0.5.0","xo":"^0.24.0"},"gitHead":"c7ad279b7b0c8264cace7fb487a6f8ef73867d7d","bugs":{"url":"https://github.com/sindresorhus/hard-rejection/issues"},"homepage":"https://github.com/sindresorhus/hard-rejection#readme","_id":"hard-rejection@2.0.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"3831e0e6cd26280b261c0686ca3181af575fca1f","size":2400,"noattachment":false,"key":"/hard-rejection/-/hard-rejection-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hard-rejection/download/hard-rejection-2.0.0.tgz"},"maintainers":[{"name":"npm:sindresorhus","email":""},{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hard-rejection_2.0.0_1552827230430_0.6926210459554436"},"_hasShrinkwrap":false,"publish_time":1552827230619,"_cnpm_publish_time":1552827230619},"1.0.0":{"name":"hard-rejection","version":"1.0.0","description":"Make unhandled promise rejections fail hard right away instead of the default silent fail","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/hard-rejection.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js","register.js"],"keywords":["promise","promises","unhandled","uncaught","rejection","hard","fail","catch","throw","handler","exit","debug","debugging","verbose","immediate","immediately"],"devDependencies":{"ava":"*","execa":"^0.6.0","xo":"*"},"gitHead":"f4b230ddbd7ee399bb79327c4a5b36110e5c7939","bugs":{"url":"https://github.com/sindresorhus/hard-rejection/issues"},"homepage":"https://github.com/sindresorhus/hard-rejection#readme","_id":"hard-rejection@1.0.0","_shasum":"8f3b476c8e2f221bed73c64640fe217d717dac36","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"8f3b476c8e2f221bed73c64640fe217d717dac36","size":2343,"noattachment":false,"key":"/hard-rejection/-/hard-rejection-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hard-rejection/download/hard-rejection-1.0.0.tgz"},"maintainers":[{"name":"npm:sindresorhus","email":""},{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/hard-rejection-1.0.0.tgz_1484302727221_0.9670357657596469"},"directories":{},"publish_time":1484302727437,"_cnpm_publish_time":1484302727437,"_hasShrinkwrap":false},"0.1.0":{"name":"hard-rejection","version":"0.1.0","description":"Make unhandled promise rejections fail hard right away instead of the default silent fail","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/hard-rejection.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js","register.js"],"keywords":["promise","promises","unhandled","uncaught","rejection","hard","fail","catch","throw","handler","exit","debug","debugging","verbose","immediate","immediately"],"devDependencies":{"ava":"*","execa":"^0.4.0","xo":"*"},"gitHead":"b17d20107d2af3a64fc60ca82fa8a3819f1a00b8","bugs":{"url":"https://github.com/sindresorhus/hard-rejection/issues"},"homepage":"https://github.com/sindresorhus/hard-rejection#readme","_id":"hard-rejection@0.1.0","_shasum":"119f7f1a81c0f76f37ee6cb0a06a937aef9495d9","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.5.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"119f7f1a81c0f76f37ee6cb0a06a937aef9495d9","size":2304,"noattachment":false,"key":"/hard-rejection/-/hard-rejection-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hard-rejection/download/hard-rejection-0.1.0.tgz"},"maintainers":[{"name":"npm:sindresorhus","email":""},{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/hard-rejection-0.1.0.tgz_1472328672666_0.8819668914657086"},"directories":{},"publish_time":1472328673702,"_cnpm_publish_time":1472328673702,"_hasShrinkwrap":false}},"readme":"# hard-rejection [![Build Status](https://travis-ci.org/sindresorhus/hard-rejection.svg?branch=master)](https://travis-ci.org/sindresorhus/hard-rejection)\n\n> Make unhandled promise rejections fail hard right away instead of the default [silent fail](https://gist.github.com/benjamingr/0237932cee84712951a2)\n\nPromises fail silently if you don't attach a `.catch()` handler.\n\nThis module exits the process with an error message right away when an unhandled rejection is encountered.<br>\n**Note: That might not be desirable as unhandled rejections can be [handled at a future point in time](https://nodejs.org/api/process.html#process_event_unhandledrejection), although not common. You've been warned.**\n\nIntended for top-level long-running processes like servers, **but not in reusable modules.**<br>\nFor command-line apps and tests, see [`loud-rejection`](https://github.com/sindresorhus/loud-rejection).\n\n\n## Install\n\n```\n$ npm install hard-rejection\n```\n\n\n## Usage\n\n```js\nconst hardRejection = require('hard-rejection');\nconst promiseFunction = require('some-promise-fn');\n\n// Install the handler\nhardRejection();\n\npromiseFunction();\n```\n\nWithout this module it's more verbose and you might even miss some that will fail silently:\n\n```js\nconst promiseFunction = require('some-promise-fn');\n\nfunction error(error) {\n\tconsole.error(error.stack);\n\tprocess.exit(1);\n}\n\npromiseFunction().catch(error);\n```\n\n### Register script\n\nAlternatively to the above, you may simply require `hard-rejection/register` and the handler will be automagically installed for you.\n\nThis is handy for ES2015 imports:\n\n```js\nimport 'hard-rejection/register';\n```\n\n\n## API\n\n### hardRejection([log])\n\n#### log\n\nType: `Function`<br>\nDefault: `console.error`\n\nCustom logging function to print the rejected promise. Receives the error stack.\n\n\n## Related\n\n- [loud-rejection](https://github.com/sindresorhus/loud-rejection) - Make unhandled promise rejections fail loudly instead of the default silent fail\n- [More…](https://github.com/sindresorhus/promise-fun)\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n","_attachments":{},"homepage":"https://github.com/sindresorhus/hard-rejection#readme","bugs":{"url":"https://github.com/sindresorhus/hard-rejection/issues"},"license":"MIT"}