Commit f85dc2a0 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '276949-sentry-2-better-than-ever' into 'master'

Pipeline Graph + Sentry: All error types

See merge request gitlab-org/gitlab!55848
parents bba340a5 7fa42b2c
...@@ -7,7 +7,7 @@ import PipelineGraph from './graph_component.vue'; ...@@ -7,7 +7,7 @@ import PipelineGraph from './graph_component.vue';
import { import {
getQueryHeaders, getQueryHeaders,
reportToSentry, reportToSentry,
serializeGqlErr, serializeLoadErrors,
toggleQueryPollingByVisibility, toggleQueryPollingByVisibility,
unwrapPipelineData, unwrapPipelineData,
} from './utils'; } from './utils';
...@@ -61,8 +61,8 @@ export default { ...@@ -61,8 +61,8 @@ export default {
update(data) { update(data) {
return unwrapPipelineData(this.pipelineProjectPath, data); return unwrapPipelineData(this.pipelineProjectPath, data);
}, },
error({ gqlError }) { error(err) {
this.reportFailure(LOAD_FAILURE, serializeGqlErr(gqlError)); this.reportFailure(LOAD_FAILURE, serializeLoadErrors(err));
}, },
}, },
}, },
......
...@@ -6,7 +6,7 @@ import LinkedPipeline from './linked_pipeline.vue'; ...@@ -6,7 +6,7 @@ import LinkedPipeline from './linked_pipeline.vue';
import { import {
getQueryHeaders, getQueryHeaders,
reportToSentry, reportToSentry,
serializeGqlErr, serializeLoadErrors,
toggleQueryPollingByVisibility, toggleQueryPollingByVisibility,
unwrapPipelineData, unwrapPipelineData,
validateConfigPaths, validateConfigPaths,
...@@ -100,13 +100,13 @@ export default { ...@@ -100,13 +100,13 @@ export default {
this.loadingPipelineId = null; this.loadingPipelineId = null;
this.$emit('scrollContainer'); this.$emit('scrollContainer');
}, },
error({ gqlError }, _vm, _key, type) { error(err, _vm, _key, type) {
this.$emit('error', LOAD_FAILURE); this.$emit('error', LOAD_FAILURE);
reportToSentry( reportToSentry(
'linked_pipelines_column', 'linked_pipelines_column',
`error type: ${LOAD_FAILURE}, error: ${serializeGqlErr( `error type: ${LOAD_FAILURE}, error: ${serializeLoadErrors(
gqlError, err,
)}, apollo error type: ${type}`, )}, apollo error type: ${type}`,
); );
}, },
......
...@@ -32,10 +32,6 @@ const reportToSentry = (component, failureType) => { ...@@ -32,10 +32,6 @@ const reportToSentry = (component, failureType) => {
}; };
const serializeGqlErr = (gqlError) => { const serializeGqlErr = (gqlError) => {
if (!gqlError) {
return 'gqlError data not available.';
}
const { locations, message, path } = gqlError; const { locations, message, path } = gqlError;
return ` return `
...@@ -48,6 +44,24 @@ const serializeGqlErr = (gqlError) => { ...@@ -48,6 +44,24 @@ const serializeGqlErr = (gqlError) => {
`; `;
}; };
const serializeLoadErrors = (errors) => {
const { gqlError, graphQLErrors, networkError, message } = errors;
if (graphQLErrors) {
return graphQLErrors.map((err) => serializeGqlErr(err)).join('; ');
}
if (gqlError) {
return serializeGqlErr(gqlError);
}
if (networkError) {
return `Network error: ${networkError.message}`;
}
return message;
};
/* eslint-enable @gitlab/require-i18n-strings */ /* eslint-enable @gitlab/require-i18n-strings */
const toggleQueryPollingByVisibility = (queryRef, interval = 10000) => { const toggleQueryPollingByVisibility = (queryRef, interval = 10000) => {
...@@ -101,6 +115,7 @@ export { ...@@ -101,6 +115,7 @@ export {
getQueryHeaders, getQueryHeaders,
reportToSentry, reportToSentry,
serializeGqlErr, serializeGqlErr,
serializeLoadErrors,
toggleQueryPollingByVisibility, toggleQueryPollingByVisibility,
unwrapPipelineData, unwrapPipelineData,
validateConfigPaths, validateConfigPaths,
......
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