diff --git a/ghost/core/core/server/lib/image/cached-image-size-from-url.js b/ghost/core/core/server/lib/image/cached-image-size-from-url.js index 23641dd74f..8c8557502b 100644 --- a/ghost/core/core/server/lib/image/cached-image-size-from-url.js +++ b/ghost/core/core/server/lib/image/cached-image-size-from-url.js @@ -34,13 +34,14 @@ class CachedImageSizeFromUrl { return cachedImageSize; } else { - return this.imageSize.getImageSizeFromUrl(url).then((res) => { + try { + const res = await this.imageSize.getImageSizeFromUrl(url); this.cache.set(url, res); debug('Cached image:', url); return this.cache.get(url); - }).catch((err) => { + } catch (err) { if (err instanceof errors.NotFoundError) { debug('Cached image (not found):', url); } else { @@ -52,7 +53,7 @@ class CachedImageSizeFromUrl { this.cache.set(url, url); return this.cache.get(url); - }); + } } } }