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

Add Sentry reporting to job log acitons

parent 858320c2
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
scrollUp, scrollUp,
} from '~/lib/utils/scroll_utils'; } from '~/lib/utils/scroll_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { reportToSentry } from '../utils';
import * as types from './mutation_types'; import * as types from './mutation_types';
export const init = ({ dispatch }, { endpoint, logState, pagePath }) => { export const init = ({ dispatch }, { endpoint, logState, pagePath }) => {
...@@ -175,11 +176,14 @@ export const fetchTrace = ({ dispatch, state }) => ...@@ -175,11 +176,14 @@ export const fetchTrace = ({ dispatch, state }) =>
dispatch('startPollingTrace'); dispatch('startPollingTrace');
} }
}) })
.catch((e) => .catch((e) => {
e.response.status === httpStatusCodes.FORBIDDEN if (e.response.status === httpStatusCodes.FORBIDDEN) {
? dispatch('receiveTraceUnauthorizedError') dispatch('receiveTraceUnauthorizedError');
: dispatch('receiveTraceError'), } else {
); reportToSentry('job_actions', e);
dispatch('receiveTraceError');
}
});
export const startPollingTrace = ({ dispatch, commit }) => { export const startPollingTrace = ({ dispatch, commit }) => {
const traceTimeout = setTimeout(() => { const traceTimeout = setTimeout(() => {
......
import * as Sentry from '@sentry/browser';
/** /**
* capture anything starting with http:// or https:// * capture anything starting with http:// or https://
* https?:\/\/ * https?:\/\/
...@@ -10,3 +12,10 @@ ...@@ -10,3 +12,10 @@
*/ */
export const linkRegex = /(https?:\/\/[^"<>()\\^`{|}\s]+[^"<>()\\^`{|}\s.,:;!?])/g; export const linkRegex = /(https?:\/\/[^"<>()\\^`{|}\s]+[^"<>()\\^`{|}\s.,:;!?])/g;
export default { linkRegex }; 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