From 4775bb3712b395178e988c7d258d693bcaff5d09 Mon Sep 17 00:00:00 2001 From: adkinsrs Date: Wed, 11 Sep 2024 09:01:07 -0400 Subject: [PATCH] better error for analysis image. --- www/js/classes/analysis.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/www/js/classes/analysis.js b/www/js/classes/analysis.js index df8e10d1..9ac305c3 100644 --- a/www/js/classes/analysis.js +++ b/www/js/classes/analysis.js @@ -573,17 +573,18 @@ class Analysis { */ async placeAnalysisImage({params, title, target} = {}) { const url = "./cgi/get_analysis_image.cgi"; - const response = await axios.get(url, { params }); - if (response?.status === 200) { - const imgSrc = response.request.responseURL; - const html = `${title}`; - document.querySelector(target).innerHTML = html; - return; + try { + const response = await axios.get(url, { params }); + if (response?.status === 200) { + const imgSrc = response.request.responseURL; + const html = `${title}`; + document.querySelector(target).innerHTML = html; + } + } catch (error) { + console.error(`Error: ${error.response?.status}`); + createToast(`Error retrieving analysis image for at least one completed step. You can re-run those steps to generate images again.`, "is-warning"); } - - console.error(`Error: ${response.status}`); - createToast(`Error getting analysis image`); } /**