better-promise-error-log
Better error logs for unhandled errors in promises.
Tested with native promises and Bluebird promises.
This module uses the sibling module, jsonify-error, to prepare the error for logging.
Installation
In Browsers
For browsers, simply include one of the dists in your entry point. The dists are available in jsDelivr:
They are also available as GitHub release assets (since 1.5.1). The following formats are available (with source maps):
better-promise-error-log.js
better-promise-error-log.min.js
(minified)better-promise-error-log.es5.js
(ES5 compatible)better-promise-error-log.es5.min.js
(ES5 compatible, minified)
In Node
npm install --save better-promise-error-log
Add the following line to the beginning of your entry point:
;
And then automatically your whole program will have better error logs for unhandled errors in promises.
Example result (in node)
// Uncomment line below to see the difference// require("better-promise-error-log");Promise;
Without require("better-promise-error-log")
:
With require("better-promise-error-log")
, you'll get something similar to:
Note: the whole error formatting is done by the sibling module, jsonify-error.
Example result (in browser)
Promise;
Without better-promise-error-log
:
With better-promise-error-log
, you'll get something similar to:
Note: the whole error formatting is done by the sibling module, jsonify-error.
Contributing
Any contribution is very welcome. Feel free to open an issue about anything: questions, suggestions, feature requests, bugs, improvements, mistakes, whatever. I will be always looking.
Changelog
The changelog is available in CHANGELOG.md.
License
MIT (c) Pedro Augusto de Paula Barbosa