Commit f5bb85b9 authored by Sarah GP's avatar Sarah GP

Refine Sentry reporting

parent e03ab73f
...@@ -106,8 +106,8 @@ export default { ...@@ -106,8 +106,8 @@ export default {
height: this.$refs[this.containerId].scrollHeight, height: this.$refs[this.containerId].scrollHeight,
}; };
}, },
onError(errorType) { onError(payload) {
this.$emit('error', errorType); this.$emit('error', payload);
}, },
setJob(jobName) { setJob(jobName) {
this.hoveredJobName = jobName; this.hoveredJobName = jobName;
......
...@@ -73,7 +73,11 @@ export default { ...@@ -73,7 +73,11 @@ export default {
return unwrapPipelineData(this.pipelineProjectPath, data); return unwrapPipelineData(this.pipelineProjectPath, data);
}, },
error(err) { error(err) {
this.reportFailure(LOAD_FAILURE, serializeLoadErrors(err)); this.reportFailure({ type: LOAD_FAILURE, skipSentry: true });
reportToSentry(
this.$options.name,
`type: ${LOAD_FAILURE}, info: ${serializeLoadErrors(err)}`,
);
}, },
result({ error }) { result({ error }) {
/* /*
...@@ -134,11 +138,15 @@ export default { ...@@ -134,11 +138,15 @@ export default {
refreshPipelineGraph() { refreshPipelineGraph() {
this.$apollo.queries.pipeline.refetch(); this.$apollo.queries.pipeline.refetch();
}, },
reportFailure(type, err = '') { /* eslint-disable @gitlab/require-i18n-strings */
reportFailure({ type, err = 'No error string passed.', skipSentry = false }) {
this.showAlert = true; this.showAlert = true;
this.alertType = type; this.alertType = type;
reportToSentry(this.$options.name, `type: ${this.alertType}, info: ${err}`); if (!skipSentry) {
reportToSentry(this.$options.name, `type: ${type}, info: ${err}`);
}
}, },
/* eslint-enable @gitlab/require-i18n-strings */
}, },
}; };
</script> </script>
......
...@@ -111,14 +111,12 @@ export default { ...@@ -111,14 +111,12 @@ export default {
this.loadingPipelineId = null; this.loadingPipelineId = null;
this.$emit('scrollContainer'); this.$emit('scrollContainer');
}, },
error(err, _vm, _key, type) { error(err) {
this.$emit('error', LOAD_FAILURE); this.$emit('error', { type: LOAD_FAILURE, skipSentry: true });
reportToSentry( reportToSentry(
'linked_pipelines_column', 'linked_pipelines_column',
`error type: ${LOAD_FAILURE}, error: ${serializeLoadErrors( `error type: ${LOAD_FAILURE}, error: ${serializeLoadErrors(err)}`,
err,
)}, apollo error type: ${type}`,
); );
}, },
}); });
......
...@@ -170,7 +170,7 @@ export default { ...@@ -170,7 +170,7 @@ export default {
const parsedData = parseData(arrayOfJobs); const parsedData = parseData(arrayOfJobs);
this.links = generateLinksData(parsedData, this.containerId, `-${this.pipelineId}`); this.links = generateLinksData(parsedData, this.containerId, `-${this.pipelineId}`);
} catch (err) { } catch (err) {
this.$emit('error', DRAW_FAILURE); this.$emit('error', { type: DRAW_FAILURE, reportToSentry: false });
reportToSentry(this.$options.name, err); reportToSentry(this.$options.name, err);
} }
this.finishPerfMeasureAndSend(); this.finishPerfMeasureAndSend();
......
...@@ -116,7 +116,7 @@ describe('Linked Pipelines Column', () => { ...@@ -116,7 +116,7 @@ describe('Linked Pipelines Column', () => {
it('emits the error', async () => { it('emits the error', async () => {
await clickExpandButton(); await clickExpandButton();
expect(wrapper.emitted().error).toEqual([[LOAD_FAILURE]]); expect(wrapper.emitted().error).toEqual([[{ type: LOAD_FAILURE, skipSentry: true }]]);
}); });
it('does not show the pipeline', async () => { it('does not show the pipeline', async () => {
...@@ -167,7 +167,7 @@ describe('Linked Pipelines Column', () => { ...@@ -167,7 +167,7 @@ describe('Linked Pipelines Column', () => {
it('emits the error', async () => { it('emits the error', async () => {
await clickExpandButton(); await clickExpandButton();
expect(wrapper.emitted().error).toEqual([[LOAD_FAILURE]]); expect(wrapper.emitted().error).toEqual([[{ type: LOAD_FAILURE, skipSentry: true }]]);
}); });
it('does not show the pipeline', async () => { it('does not show the pipeline', async () => {
......
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