{"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","tarball":"http://registry-npm.ywwl.com/hard-rejection/download/hard-rejection-0.1.0.tgz","integrity":"sha512-+ZgfwrJSSeuwdRJ1g/ieH5R1L5oTLVI6UD2rOf1KsynIdiQcE+oHMNAdBlorZ3dNmbVWXKxp6vkXPY1YTHQrbQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGfUPbBTYizyoXN+FTPjpe9+U+HR9DRv1eBi8SBOmUdoAiEA6zG/ATeDZG3PdYuWF4wbY2De3lRMDh5XDMJdb0ANic4="}],"size":2304,"noattachment":false,"key":"/hard-rejection/-/hard-rejection-0.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/hard-rejection-0.1.0.tgz_1472328672666_0.8819668914657086"},"directories":{},"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","publish_time":1472328673702,"_cnpm_publish_time":1472328673702,"dist-tags":{"latest":"2.1.0"}}