This repository has been archived by the owner on Dec 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Cawllec/fix shouldnt notify logging #113
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
41b201c
Added default disabling of notification errors if not shouldNotify an…
Cawllec 8871360
Added default disabling of notification errors if not shouldNotify an…
Cawllec 6ca0fa6
Merge branch 'cawllec/fix-shouldnt-notify-logging' of github.com:bugs…
Cawllec e302522
Updated ts interface
Cawllec b094305
Removed extra config
Cawllec 1f9c0df
Added original error logging if not shouldnotify
Cawllec a82fbb2
Removed config opt from ts
Cawllec b136ad8
Better error logging
Cawllec cbc9e51
Updated text, better error information logging
Cawllec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,17 @@ Bugsnag.register = function(apiKey, options) { | |
Bugsnag.configure = function(options) { | ||
Configuration.configure(options); | ||
|
||
// If notify release stages is set and we're not going to be notifying bugsnag we need to log | ||
// this once and then prevent it from being logged in the future | ||
if (!Bugsnag.shouldNotify()) { | ||
Configuration.logger.warn(Configuration.apiKey ? | ||
"Current release stage not permitted to send events to Bugsnag." : | ||
"Bugsnag has not been configured with an api key!"); | ||
Configuration.logger.warn(Configuration.logAllDeliveryErrors ? | ||
"Delivery errors will still be reported" : | ||
"Delivery errors will not be reported. Configure logAllDeliveryErrors to change this behaviour"); | ||
} | ||
|
||
// If we should auto notify we also configure the uncaught exception handler, we can't do this | ||
// by default as it changes the way the app response by removing the default handler. | ||
if (Configuration.autoNotifyUncaught && !unCaughtErrorHandlerAdded) { | ||
|
@@ -92,7 +103,7 @@ Bugsnag.notify = function(error, options, cb) { | |
options = {}; | ||
} | ||
if (!Bugsnag.shouldNotify()) { | ||
if (cb) { | ||
if (cb && Configuration.logAllDeliveryErrors) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this branch could be in a more appropriate place, as the the option mentions A better place would be in the definition of |
||
if (!Configuration.apiKey) { | ||
cb(new Error("Bugsnag has not been configured with an api key!")); | ||
} else { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ var Configuration = { | |
metaData: {}, | ||
logger: new Logger(), | ||
sendCode: true, | ||
logAllDeliveryErrors: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name of this option might want changing to be consistent with the log message. |
||
|
||
beforeNotifyCallbacks: [], | ||
|
||
|
@@ -61,6 +62,7 @@ var Configuration = { | |
Configuration.metaData = options.metaData || Configuration.metaData; | ||
Configuration.onUncaughtError = options.onUncaughtError || Configuration.onUncaughtError; | ||
Configuration.hostname = options.hostname || Configuration.hostname; | ||
Configuration.logAllDeliveryErrors = options.logAllDeliveryErrors || Configuration.logAllDeliveryErrors; | ||
Configuration.proxy = options.proxy; | ||
Configuration.headers = options.headers; | ||
if (options.projectRoot != null) { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these log messages are confusing and could be worded better…
Something along the lines of:
"Calls to bugsnag.notify() will silently fail"
or
"Nothing will be sent to Bugsnag. Any bugsnag.notify() calls are essentially NOOPs."