How to use the @sentry/browser.Severity function in @sentry/browser

To help you get started, we’ve selected a few @sentry/browser 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 ONEARMY / community-platform / src / common / errors.ts View on Github external
import * as Sentry from '@sentry/browser'
import { SENTRY_CONFIG } from '../config/config'

export const log = {
  message: Sentry.captureMessage,
  event: Sentry.captureEvent,
  exception: Sentry.captureException,
}
export const Level = Sentry.Severity
export const initErrorHandler = () => {
  if (
    location.search.indexOf('noSentry=true') !== -1 ||
    location.hostname === 'localhost'
  ) {
    return
  }
  // please check https://docs.sentry.io/error-reporting/configuration/?platform=javascript for options
  Sentry.init({
    dsn: SENTRY_CONFIG.dsn,
  })
}
github getsentry / sentry / src / sentry / static / sentry / app / api.tsx View on Github external
Sentry.withScope(scope => {
              // `requestPromise` can pass its error object
              const preservedError = options.preservedError || errorObject;

              const errorObjectToUse = createRequestError(
                resp,
                preservedError.stack,
                method,
                path
              );

              errorObjectToUse.removeFrames(2);

              // Setting this to warning because we are going to capture all failed requests
              scope.setLevel(Sentry.Severity.Warning);
              scope.setTag('http.statusCode', String(resp.status));
              Sentry.captureException(errorObjectToUse);
            });
          }
github getsentry / sentry / src / sentry / static / sentry / app / components / asyncComponent.tsx View on Github external
handleError(error, args) {
    const [stateKey] = args;
    if (error && error.responseText) {
      Sentry.addBreadcrumb({
        message: error.responseText,
        category: 'xhr',
        level: Sentry.Severity.Error,
      });
    }
    this.setState(prevState => {
      const loading = prevState.remainingRequests! > 1;
      const state: AsyncComponentState = {
        [stateKey]: null,
        errors: {
          ...prevState.errors,
          [stateKey]: error,
        },
        error: prevState.error || !!error,
        remainingRequests: prevState.remainingRequests! - 1,
        loading,
        reloading: prevState.reloading && loading,
      };
      this.markShouldMeasure({remainingRequests: state.remainingRequests, error: true});
github getsentry / sentry / src / sentry / static / sentry / app / translations.tsx View on Github external
Sentry.withScope(scope => {
      scope.setLevel(Sentry.Severity.Warning);
      scope.setFingerprint(['sentry-locale-not-found']);
      scope.setExtra('locale', language);
      Sentry.captureException(e);
    });
github streamr-dev / streamr-platform / app / src / shared / contexts / Undo / useUndoBreadcrumbs.js View on Github external
useLayoutEffect(() => {
        if (!isEnabled) { return }
        const wasUndo = pointer < lastPointerRef.current
        lastPointerRef.current = pointer
        const { type } = action
        Sentry.addBreadcrumb({
            category: 'action',
            message: `${type}${wasUndo ? ' (Undo)' : ''}`,
            data: action,
            level: Sentry.Severity.Info,
        })
    }, [action, pointer, isEnabled])
}
github stream-labs / streamlabs-obs / app / app.ts View on Github external
Sentry.withScope(scope => {
      if (params[0] instanceof Error) {
        scope.setExtra('exception', params[0].stack);
      }

      scope.setExtra('console-args', JSON.stringify(params, null, 2));
      Sentry.captureMessage(msg, Sentry.Severity.Error);
    });
  };