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

sentry_utils.js « runner « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 25fecdcfa7d58956be3cc2ff088524de572d7112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 Exception details
 * @param {Object} options.error An exception-like object
 * @param {string} [options.component=] Component name in CamelCase format
 */
export const captureException = ({ error, component }) => {
  if (component) {
    Sentry.captureException(error, {
      tags: { [COMPONENT_TAG]: component },
    });
  } else {
    Sentry.captureException(error);
  }
};