Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # hard-rejection [![Build Status](https://travis-ci.org/sindresorhus/hard-rejection.svg?branch=master)](https://travis-ci.org/sindresorhus/hard-rejection)
  2. > Make unhandled promise rejections fail hard right away instead of the default [silent fail](https://gist.github.com/benjamingr/0237932cee84712951a2)
  3. Promises fail silently if you don't attach a `.catch()` handler.
  4. This module exits the process with an error message right away when an unhandled rejection is encountered.<br>
  5. **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.**
  6. Intended for top-level long-running processes like servers, **but not in reusable modules.**<br>
  7. For command-line apps and tests, see [`loud-rejection`](https://github.com/sindresorhus/loud-rejection).
  8. ## Install
  9. ```
  10. $ npm install hard-rejection
  11. ```
  12. ## Usage
  13. ```js
  14. const hardRejection = require('hard-rejection');
  15. const promiseFunction = require('some-promise-fn');
  16. // Install the handler
  17. hardRejection();
  18. promiseFunction();
  19. ```
  20. Without this module it's more verbose and you might even miss some that will fail silently:
  21. ```js
  22. const promiseFunction = require('some-promise-fn');
  23. function error(error) {
  24. console.error(error.stack);
  25. process.exit(1);
  26. }
  27. promiseFunction().catch(error);
  28. ```
  29. ### Register script
  30. Alternatively to the above, you may simply require `hard-rejection/register` and the handler will be automagically installed for you.
  31. This is handy for ES2015 imports:
  32. ```js
  33. import 'hard-rejection/register';
  34. ```
  35. ## API
  36. ### hardRejection([log])
  37. #### log
  38. Type: `Function`<br>
  39. Default: `console.error`
  40. Custom logging function to print the rejected promise. Receives the error stack.
  41. ## Related
  42. - [loud-rejection](https://github.com/sindresorhus/loud-rejection) - Make unhandled promise rejections fail loudly instead of the default silent fail
  43. - [More…](https://github.com/sindresorhus/promise-fun)
  44. ## License
  45. MIT © [Sindre Sorhus](https://sindresorhus.com)