Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Commit

Permalink
Call previous exception handler when notify cancelled
Browse files Browse the repository at this point in the history
Fixes #106
  • Loading branch information
kattrali committed Aug 2, 2017
1 parent a784198 commit f1d603d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Bugsnag.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Client {

ErrorUtils.setGlobalHandler((error, isFatal) => {
if (this.config.autoNotify && this.config.shouldNotify()) {
this.notify(error, report => {report.severity = 'error'}, !!NativeClient.notifyBlocking, () => {
this.notify(error, report => {report.severity = 'error'}, !!NativeClient.notifyBlocking, (queued) => {
if (previousHandler) {
previousHandler(error, isFatal);
}
Expand Down Expand Up @@ -76,9 +76,13 @@ export class Client {
notify = async (error, beforeSendCallback, blocking, postSendCallback) => {
if (!(error instanceof Error)) {
console.warn('Bugsnag could not notify: error must be of type Error');
if (postSendCallback)
postSendCallback(false);
return;
}
if (!this.config.shouldNotify()) {
if (postSendCallback)
postSendCallback(false);
return;
}

Expand All @@ -87,6 +91,8 @@ export class Client {

for (callback of this.config.beforeSendCallbacks) {
if (callback(report, error) === false) {
if (postSendCallback)
postSendCallback(false);
return;
}
}
Expand All @@ -99,7 +105,7 @@ export class Client {
} else {
NativeClient.notify(report.toJSON());
if (postSendCallback)
postSendCallback();
postSendCallback(true);
}
}

Expand Down

0 comments on commit f1d603d

Please sign in to comment.