From abbb29c273d4ed2f4558f9d177dd5bae403e6a5e Mon Sep 17 00:00:00 2001 From: Shinsina Date: Wed, 6 Apr 2022 10:27:44 -0500 Subject: [PATCH] Fix error messaging when image resolution goes bad --- .../graphql-server/src/graphql/utils/get-image-dimensions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/graphql-server/src/graphql/utils/get-image-dimensions.js b/services/graphql-server/src/graphql/utils/get-image-dimensions.js index 806d2ba1a..de7fc7251 100644 --- a/services/graphql-server/src/graphql/utils/get-image-dimensions.js +++ b/services/graphql-server/src/graphql/utils/get-image-dimensions.js @@ -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 });