From b22ea953d5a136480a5993a89710c45745ab34a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 21 Feb 2023 10:38:58 +0100 Subject: [PATCH] Webapp: catch error when job cannot be found Fetching a non-existent job can happen due to the asynchronous nature of the webapp, when a job was just deleted. It now no longer complains about this in the JS debug console. --- web/app/src/views/JobsView.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/app/src/views/JobsView.vue b/web/app/src/views/JobsView.vue index 1282db69..3063d05f 100644 --- a/web/app/src/views/JobsView.vue +++ b/web/app/src/views/JobsView.vue @@ -231,7 +231,16 @@ export default { // Forward the full job to Tabulator, so that that gets updated too. this.$refs.jobsTable.processJobUpdate(job); this._recalcTasksTableHeight(); - }); + }) + .catch((err) => { + if (err.status == 404) { + // It can happen that a job cannot be found, for example when it was asynchronously deleted. + this.jobs.deselectAllJobs(); + return; + } + console.log(`Unable to fetch job ${jobID}:`, err); + }) + ; }, /**