diff --git a/src/util/ajax.js b/src/util/ajax.js index 89957977740..befd99aefc3 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -162,6 +162,7 @@ export const getImage = function(requestParameters: RequestParameters, callback: callback(null, img); URL.revokeObjectURL(img.src); }; + img.onerror = () => callback(new Error('Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.')); const blob: Blob = new window.Blob([new Uint8Array(imgData.data)], { type: 'image/png' }); (img: any).cacheControl = imgData.cacheControl; (img: any).expires = imgData.expires;