Skip to content

Commit

Permalink
better error for analysis image.
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Sep 11, 2024
1 parent 5001a35 commit 4775bb3
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions www/js/classes/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<a target="_blank" href="${imgSrc}"><img src="${imgSrc}" class="image" alt="${title}" /></a>`;
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 = `<a target="_blank" href="${imgSrc}"><img src="${imgSrc}" class="image" alt="${title}" /></a>`;
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`);
}

/**
Expand Down

0 comments on commit 4775bb3

Please sign in to comment.