debian-mirror-gitlab/app/assets/javascripts/jobs/utils.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
906 B
JavaScript
Raw Normal View History

2021-10-27 15:23:28 +05:30
import * as Sentry from '@sentry/browser';
2021-02-22 17:27:13 +05:30
/**
* capture anything starting with http:// or https://
* https?:\/\/
*
* up until a disallowed character or whitespace
2021-09-30 23:02:18 +05:30
* [^"<>()\\^`{|}\s]+
2021-02-22 17:27:13 +05:30
*
* and a disallowed character or whitespace, including non-ending chars .,:;!?
2021-09-30 23:02:18 +05:30
* [^"<>()\\^`{|}\s.,:;!?]
2021-02-22 17:27:13 +05:30
*/
2021-09-30 23:02:18 +05:30
export const linkRegex = /(https?:\/\/[^"<>()\\^`{|}\s]+[^"<>()\\^`{|}\s.,:;!?])/g;
2021-01-29 00:20:46 +05:30
export default { linkRegex };
2021-10-27 15:23:28 +05:30
export const reportToSentry = (component, failureType) => {
Sentry.withScope((scope) => {
scope.setTag('component', component);
Sentry.captureException(failureType);
});
};
2021-11-18 22:05:49 +05:30
export const reportMessageToSentry = (component, message, context) => {
Sentry.withScope((scope) => {
// eslint-disable-next-line @gitlab/require-i18n-strings
scope.setContext('Vue data', context);
scope.setTag('component', component);
Sentry.captureMessage(message);
});
};