aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util/error_reporter.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant/src/util/error_reporter.ts')
-rw-r--r--packages/instant/src/util/error_reporter.ts66
1 files changed, 33 insertions, 33 deletions
diff --git a/packages/instant/src/util/error_reporter.ts b/packages/instant/src/util/error_reporter.ts
index a03b5e65e..c5766b469 100644
--- a/packages/instant/src/util/error_reporter.ts
+++ b/packages/instant/src/util/error_reporter.ts
@@ -1,4 +1,5 @@
import { logUtils } from '@0x/utils';
+import * as _ from 'lodash';
import { ROLLBAR_CLIENT_TOKEN, ROLLBAR_ENVIRONMENT } from '../constants';
@@ -15,41 +16,40 @@ const shouldAllowRollbar = () => {
};
let rollbar: any;
-if (ROLLBAR_CLIENT_TOKEN && ROLLBAR_ENVIRONMENT && shouldAllowRollbar()) {
- rollbar = new Rollbar({
- accessToken: ROLLBAR_CLIENT_TOKEN,
- captureUncaught: true,
- captureUnhandledRejections: true,
- enabled: true,
- itemsPerMinute: 10,
- maxItems: 500,
- payload: {
- environment: ROLLBAR_ENVIRONMENT,
- client: {
- javascript: {
- source_map_enabled: true,
- code_version: process.env.GIT_SHA,
- guess_uncaught_frames: true,
+// Configures rollbar and sets up error catching
+export const setupRollbar = (): any => {
+ if (_.isUndefined(rollbar) && ROLLBAR_CLIENT_TOKEN && ROLLBAR_ENVIRONMENT && shouldAllowRollbar()) {
+ rollbar = new Rollbar({
+ accessToken: ROLLBAR_CLIENT_TOKEN,
+ captureUncaught: true,
+ captureUnhandledRejections: true,
+ enabled: true,
+ itemsPerMinute: 10,
+ maxItems: 500,
+ payload: {
+ environment: ROLLBAR_ENVIRONMENT,
+ client: {
+ javascript: {
+ source_map_enabled: true,
+ code_version: process.env.GIT_SHA,
+ guess_uncaught_frames: true,
+ },
},
},
- },
- uncaughtErrorLevel: 'error',
- ignoredMessages: [
- // Errors from the third-party scripts
- 'Script error',
- // Network errors or ad-blockers
- 'TypeError: Failed to fetch',
- 'Exchange has not been deployed to detected network (network/artifact mismatch)',
- // Source: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/7VU0_VvC7mE
- "undefined is not an object (evaluating '__gCrWeb.autofill.extractForms')",
- // Source: http://stackoverflow.com/questions/43399818/securityerror-from-facebook-and-cross-domain-messaging
- 'SecurityError (DOM Exception 18)',
- ],
- });
-}
-
-export const setupRollbar = (): any => {
- return rollbar;
+ uncaughtErrorLevel: 'error',
+ ignoredMessages: [
+ // Errors from the third-party scripts
+ 'Script error',
+ // Network errors or ad-blockers
+ 'TypeError: Failed to fetch',
+ 'Exchange has not been deployed to detected network (network/artifact mismatch)',
+ // Source: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/7VU0_VvC7mE
+ "undefined is not an object (evaluating '__gCrWeb.autofill.extractForms')",
+ // Source: http://stackoverflow.com/questions/43399818/securityerror-from-facebook-and-cross-domain-messaging
+ 'SecurityError (DOM Exception 18)',
+ ],
+ });
+ }
};
export const errorReporter = {