mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Refactored cached image sized module async error handling
refs https://github.com/TryGhost/Toolbox/issues/364 - A little cleanup
This commit is contained in:
parent
92d6c998b3
commit
58a656cbc2
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user