The make-promises-safe
package changes Node.js's default behavior with regards to errors thrown in promises. Normally, in Node, these unhandled promise rejections will be logged, but a program keeps on running. With make-promises-safe
installed, Node.js will exit when it encounters an unhandled promise rejection. The "safe" here means that your program won't have secret unhandled rejections, since unhandled rejections often line up with resources that have not been properly cleaned up, and these non-cleaned up resources can cause problems in a long running program.
All that I understand. However, this module comes with a warning
It is important that this module is only used in top-level program code, not in reusable modules!
The purpose of this warning is unclear. Why is it that the module authors advise folks against using this module in their own reusable modules?