Skip to content

Commit

Permalink
Replace throwing 404 error when the asset is not found, with asset.sv…
Browse files Browse the repository at this point in the history
…g icon
  • Loading branch information
TyroneAEM committed Jun 11, 2024
1 parent ba077db commit 2e5863a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions scripts/polaris.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,10 @@ export async function authorizeURL(url) {

const response = await fetch(url, options);


if (!response.ok) {
// Handle specific HTTP errors
if (response.status === 404) {
throw new Error('Not Found (404)');
} else {
throw new Error(`HTTP error! Status: ${response.status}`);
}
// Return the full URL to the asset icon if the response is not OK, as the asset was not found
return new URL('/icons/asset.svg', window.location.origin).href;
}

const imageBlob = await response.blob();
Expand Down

0 comments on commit 2e5863a

Please sign in to comment.