Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sentry_utils.js « runner « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 29de1f9adaefeb0d7a3e396ba2ccfc6f43e1e3c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import * as Sentry from '@sentry/browser';

const COMPONENT_TAG = 'vue_component';

/**
 * Captures an error in a Vue component and sends it
 * to Sentry
 *
 * @param {Object} options
 * @param {Error} options.error - Exception or error
 * @param {String} options.component - Component name in CamelCase format
 */
export const captureException = ({ error, component }) => {
  Sentry.withScope((scope) => {
    if (component) {
      scope.setTag(COMPONENT_TAG, component);
    }
    Sentry.captureException(error);
  });
};