Skip to content

Commit

Permalink
feat: allow disable of global event wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
waltjones committed Aug 2, 2019
1 parent 12409ba commit 833b1bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions sdks/rollbar.js/src/browser/rollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ Rollbar.prototype.setupUnhandledCapture = function() {
if (!this.unhandledExceptionsInitialized) {
if (this.options.captureUncaught || this.options.handleUncaughtExceptions) {
globals.captureUncaughtExceptions(gWindow, this);
globals.wrapGlobals(gWindow, this);
if (this.options.wrapGlobalEventHandlers) {
globals.wrapGlobals(gWindow, this);
}
this.unhandledExceptionsInitialized = true;
}
}
Expand Down Expand Up @@ -534,7 +536,8 @@ var defaultOptions = {
includeItemsInTelemetry: true,
captureIp: true,
inspectAnonymousErrors: true,
ignoreDuplicateErrors: true
ignoreDuplicateErrors: true,
wrapGlobalEventHandlers: true
};

module.exports = Rollbar;
4 changes: 3 additions & 1 deletion sdks/rollbar.js/src/browser/shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ function setupShim(window, options) {
if (options.captureUncaught) {
handler._rollbarOldOnError = window.onerror;
globals.captureUncaughtExceptions(window, handler, true);
globals.wrapGlobals(window, handler, true);
if (this.options.wrapGlobalEventHandlers) {
globals.wrapGlobals(window, handler, true);
}
}

if (options.captureUnhandledRejections) {
Expand Down

0 comments on commit 833b1bd

Please sign in to comment.