Commit 8784dedb authored by Jose Vargas's avatar Jose Vargas

Add Sentry reporting to job log acitons

parent 858320c2
......@@ -13,6 +13,7 @@ import {
scrollUp,
} from '~/lib/utils/scroll_utils';
import { __ } from '~/locale';
import { reportToSentry } from '../utils';
import * as types from './mutation_types';
export const init = ({ dispatch }, { endpoint, logState, pagePath }) => {
......@@ -175,11 +176,14 @@ export const fetchTrace = ({ dispatch, state }) =>
dispatch('startPollingTrace');
}
})
.catch((e) =>
e.response.status === httpStatusCodes.FORBIDDEN
? dispatch('receiveTraceUnauthorizedError')
: dispatch('receiveTraceError'),
);
.catch((e) => {
if (e.response.status === httpStatusCodes.FORBIDDEN) {
dispatch('receiveTraceUnauthorizedError');
} else {
reportToSentry('job_actions', e);
dispatch('receiveTraceError');
}
});
export const startPollingTrace = ({ dispatch, commit }) => {
const traceTimeout = setTimeout(() => {
......
import * as Sentry from '@sentry/browser';
/**
* capture anything starting with http:// or https://
* https?:\/\/
......@@ -10,3 +12,10 @@
*/
export const linkRegex = /(https?:\/\/[^"<>()\\^`{|}\s]+[^"<>()\\^`{|}\s.,:;!?])/g;
export default { linkRegex };
export const reportToSentry = (component, failureType) => {
Sentry.withScope((scope) => {
scope.setTag('component', component);
Sentry.captureException(failureType);
});
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment