THIS IS A BREAKING CHANGE. This patch prevents unhandled Promise rejections from crashing the process by allowing the caller to handle them instead.
To properly call Builder#analyze(), you must change your code from:
builder.analyze(function(results) {
// Do something with results
});
To:
builder.analyze(function(err, results) {
if (err) {
// handle error
}
// Do something with results
});
Additionally, when using the Promise returned by Builder#analyze(), you must add a .catch() block to handle the possible rejection. For example:
builder
.analyze()
.then(results => {
// Do something with results
})
.catch(err => {
// handle error
});
NOTE: when using a Promise and a callback, the Promise will never be rejected. The callback will be provided the error instead. This ensures we don't require users to handle the same error twice.
Fixes #56.
Reviewer checks
Required fields, to be filled out by PR reviewer(s)
[ ] Follows the commit message policy, appropriate for next version
[ ] Has documentation updated, a DU ticket, or requires no documentation change
[ ] Includes new tests, or was unnecessary
[ ] Code is reviewed for security by: << Name here >>
THIS IS A BREAKING CHANGE. This patch prevents unhandled Promise rejections from crashing the process by allowing the caller to handle them instead.
To properly call
Builder#analyze()
, you must change your code from:To:
Additionally, when using the Promise returned by
Builder#analyze()
, you must add a.catch()
block to handle the possible rejection. For example:NOTE: when using a Promise and a callback, the Promise will never be rejected. The callback will be provided the error instead. This ensures we don't require users to handle the same error twice.
Fixes #56.
Reviewer checks
Required fields, to be filled out by PR reviewer(s)