How to use raven-js - 10 common examples

To help you get started, we’ve selected a few raven-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / raven-js_v3.17.x / test_raven-js.js View on Github external
it("works", () => {
      const isSetup: boolean = Raven.isSetup();

      // $ExpectError - Raven.isSetup returns a boolean
      const isSetupString: string = Raven.isSetup();
    });
  });
github flow-typed / flow-typed / definitions / npm / raven-js_v3.17.x / test_raven-js.js View on Github external
eventId: "eventId",
        ddsn: "dsn",
        user: {
          name: "name",
          email: "email"
        }
      });

      // $ExpectError - eventId must be a string
      Raven.showReportDialog({ eventId: 1 });

      // $ExpectError - dsn must be a string
      Raven.showReportDialog({ dsn: 1 });

      // $ExpectError - user name must be a string
      Raven.showReportDialog({
        user: { name: { first: "first", last: "last" } }
      });
    });
  });
github ngokevin / redux-raven-middleware / index.es6 View on Github external
actionTransformer = identity,
      stateTransformer = identity,
      logger = console.error.bind(console, '[redux-raven-middleware] Reporting error to Sentry:')
    } = options;
    try {
      Raven.captureBreadcrumb({
        category: 'redux',
        message: action.type
      });

      return next(action);
    } catch (err) {
      logger(err);

      // Send the report.
      Raven.captureException(err, {
        extra: {
          action: actionTransformer(action),
          state: stateTransformer(store.getState()),
        }
      });
    }
  }
}
github commercetools / merchant-center-application-kit / src / middleware / sentry-tracking.js View on Github external
action.type === ADD_NOTIFICATION &&
    action.payload.kind === 'unexpected-error'
  ) {
    const {
      meta: { error },
    } = action;

    // Check that the `error` is set
    if (!error && process.env.NODE_ENV !== 'production')
      // eslint-disable-next-line no-console
      console.error('Missing error object when dispatching unexpected error.');

    if (process.env.NODE_ENV !== 'production') return next(action);

    // Send the error to Sentry
    Raven.captureException(error);
    // Generate a unique ID referring to the last generated Sentry error
    const errorId = Raven.lastEventId();

    // The error stack should be available in Sentry, so there is no
    // need to print it in the console as well.
    // We just notify that an error occured and provide the error ID.
    // eslint-disable-next-line no-console
    console.error(`An error occured (ID: ${errorId}).`);

    // Inject the generated errorId into the notification values,
    // in order to display it in the notification message.
    return next({
      ...action,
      payload: {
        ...action.payload,
        values: {
github wellcometrust / wellcomecollection.org / common / views / pages / _app.js View on Github external
}

        if (validationFails.length > 0) {
          validationFails.forEach(function(validationFail) {
            var div = document.createElement('div');
            div.style.marginBottom = '6px';
            div.innerHTML = validationFail;
            validationBar.appendChild(div);
          });
          document.body && document.body.appendChild(validationBar);
        }
      })();
    }

    // Raven
    Raven.config('https://f756b8d4b492473782987a054aa9a347@sentry.io/133634', {
      shouldSendCallback(data) {
        const oldSafari = /^.*Version\/[0-8].*Safari.*$/;
        const bingPreview = /^.*BingPreview.*$/;

        return ![oldSafari, bingPreview].some(r =>
          r.test(window.navigator.userAgent)
        );
      },
      whitelistUrls: [/wellcomecollection\.org/],
      ignoreErrors: [
        /Blocked a frame with origin/,
        /document\.getElementsByClassName\.ToString/, // https://github.com/SamsungInternet/support/issues/56
      ],
    }).install();
  }
github assembl / assembl / assembl / static / js / app / views / baseMessageList.js View on Github external
console.log("scrollToMessage called with args:", messageModel.id, shouldHighlightMessageSelected, shouldOpenMessageSelected, callback, failedCallback, recursionDepth, originalRenderId);
      }

      recursionDepth = recursionDepth || 0;
      originalRenderId = originalRenderId || _.clone(this._renderId);
      var RETRY_INTERVAL = Math.floor(200 * Math.log(2 + recursionDepth));  // increasing interval

      shouldHighlightMessageSelected = (typeof shouldHighlightMessageSelected === "undefined") ? true : shouldHighlightMessageSelected;
      shouldOpenMessageSelected = (typeof shouldOpenMessageSelected === "undefined") ? true : shouldOpenMessageSelected;

      if (!messageModel) {
        throw new Error("scrollToMessage(): ERROR:  messageModel wasn't provided");
      }

      if (recursionDepth === 0 && this._scrollToMessageInProgressId) {
        Raven.captureMessage("scrollToMessage():  a scrollToMessage was already in progress, aborting", {message_id: messageModel.id})
        if (_.isFunction(failedCallback)) {
          failedCallback();
        }

        return;
      }
      else if (originalRenderId !== this._renderId) {
        //This is a normal condition now
        //console.log("scrollToMessage():  obsolete render, aborting for ", messageModel.id);
        //Raven.captureMessage("scrollToMessage():  obsolete render, aborting", {message_id: messageModel.id})
        if (this._scrollToMessageInProgressId === originalRenderId) {
          this._scrollToMessageInProgressId = false;
        }

        if (_.isFunction(failedCallback)) {
          failedCallback();
github simon-weber / Autoplaylists-for-Google-Music / src / js / reporting.js View on Github external
function setContext(isBackground, context) {
  console.log('setting context:', isBackground, context);

  cachedContext = context;

  GATracker.set('userId', context.reportingUUID);
  GATracker.set('dimension1', context.tags.hasFullVersion ? 'full' : 'free');
  GATracker.set('dimension2', context.tags.isDeveloper ? 'yes' : 'no');
  GATracker.set('dimension5', context.tags.licenseState);

  Raven.setUserContext(context.user);
  context.tags.isBackground = isBackground; // eslint-disable-line no-param-reassign
  Raven.setTagsContext(context.tags);
}
github simon-weber / Autoplaylists-for-Google-Music / src / js / reporting.js View on Github external
function setContext(isBackground, context) {
  console.log('setting context:', isBackground, context);

  cachedContext = context;

  GATracker.set('userId', context.reportingUUID);
  GATracker.set('dimension1', context.tags.hasFullVersion ? 'full' : 'free');
  GATracker.set('dimension2', context.tags.isDeveloper ? 'yes' : 'no');

  Raven.setUserContext(context.user);
  context.tags.isBackground = isBackground; // eslint-disable-line no-param-reassign
  Raven.setTagsContext(context.tags);
}
github T-Systems-MMS / phonebook / Phonebook.Frontend / src / app / shared / error / error.module.ts View on Github external
public handleError(error: any): void {
    if (error.name === 'HttpErrorResponse') {
      return;
    }

    if (runtimeEnvironment.environment !== Environment.development) {
      // App is in Production
      if (runtimeEnvironment.ravenURL) {
        // Raven enabled
        console.error(error);
        Raven.captureException(error);
        if (JSON.parse(localStorage.getItem('appstate') || '').sendFeedback || false) {
          Raven.showReportDialog();
        }
      } else {
        // Nothing, maybe later an error Dialog
        console.error(error);
      }
    } else {
      // App is in Development
      throw error;
    }
  }
}
github outcobra / outstanding-cobra / frontend / src / app / core / error / raven-error-handler.ts View on Github external
handleError(error: any): void {
        if (environment.production) {
            // In IE, originalError is not always set apparently
            if (error.originalError) {
                Raven.captureException(error.originalError);
            } else {
                Raven.captureException(error);
            }
            Raven.showReportDialog({});
        } else {
            console.error(error);
        }
    }
}