2021-08-05 11:09:46 -04:00
|
|
|
import * as Sentry from '@sentry/browser';
|
|
|
|
|
2020-11-20 16:09:12 -05:00
|
|
|
/**
|
|
|
|
* capture anything starting with http:// or https://
|
|
|
|
* https?:\/\/
|
|
|
|
*
|
|
|
|
* up until a disallowed character or whitespace
|
2021-07-13 17:08:20 -04:00
|
|
|
* [^"<>()\\^`{|}\s]+
|
2020-11-20 16:09:12 -05:00
|
|
|
*
|
|
|
|
* and a disallowed character or whitespace, including non-ending chars .,:;!?
|
2021-07-13 17:08:20 -04:00
|
|
|
* [^"<>()\\^`{|}\s.,:;!?]
|
2020-11-20 16:09:12 -05:00
|
|
|
*/
|
2021-07-13 17:08:20 -04:00
|
|
|
export const linkRegex = /(https?:\/\/[^"<>()\\^`{|}\s]+[^"<>()\\^`{|}\s.,:;!?])/g;
|
2020-11-16 13:09:15 -05:00
|
|
|
export default { linkRegex };
|
2021-08-05 11:09:46 -04:00
|
|
|
|
|
|
|
export const reportToSentry = (component, failureType) => {
|
|
|
|
Sentry.withScope((scope) => {
|
|
|
|
scope.setTag('component', component);
|
|
|
|
Sentry.captureException(failureType);
|
|
|
|
});
|
|
|
|
};
|
2021-10-06 11:11:48 -04:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
};
|