Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
Merge pull request #124 from bugsnag/dedupe-logging
Browse files Browse the repository at this point in the history
Prevent duplicate log for undelivered error, fixes #123
  • Loading branch information
bengourley authored Jan 8, 2018
2 parents 7f4ee1c + 163a307 commit ff5dfbc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/bugsnag.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ function autoNotifyCallback(notifiedError, uncaughtError) {
errorMsg.push("configuration options prevent the following error from being sent to Bugsnag.");
errorMsg.push("https://docs.bugsnag.com/platforms/nodejs/other/configuration-options/#notifyreleasestages");
}
errorMsg.push("");
errorMsg.push(notifiedError.stack);
// only print caught errors at this point. uncaught errors get printed by
// the onUncaughtError function later so this prevents duplicate logs
if (!(Configuration.onUncaughtError && uncaughtError)) {
errorMsg.push("");
errorMsg.push(notifiedError.stack);
}
}
errorMsg.push("");
Configuration.logger.error(errorMsg.join('\n'));
Expand Down

0 comments on commit ff5dfbc

Please sign in to comment.