Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #271 from Shinsina/fix-image-error-handling
Browse files Browse the repository at this point in the history
Fix error messaging when image resolution fails
  • Loading branch information
zarathustra323 authored Apr 6, 2022
2 parents 9b8811f + abbb29c commit 91c3df8
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ module.exports = async ({
if (width && height) return { width, height };
const url = `https://${host}/${filePath}/${fileName}?fm=json`;
const res = await fetch(url);
if (!res.ok) throw new Error(res.statusText);
if (!res.ok) {
throw new Error(`Image at ${filePath}/${fileName} ${res.statusText} ID: ${image._id}`);
}
const { PixelWidth, PixelHeight } = await res.json();
const $set = { width: PixelWidth, height: PixelHeight };
await basedb.updateOne('platform.Asset', { _id: image._id }, { $set });
Expand Down

0 comments on commit 91c3df8

Please sign in to comment.