Skip to content

Commit

Permalink
add error handling for non-xhr image loads
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Jul 31, 2018
1 parent 0ac9e35 commit b263d33
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/util/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const getImage = function(requestParameters: RequestParameters, callback:
if (!sameOrigin(url)) {
img.crossOrigin = 'Anonymous';
}
img.onerror = () => callback(new Error(`Could not load image: ${url}`));
img.onload = () => callback(null, img);
img.src = url;
return {cancel: () => { img.src = transparentPngUrl; }};
Expand Down

0 comments on commit b263d33

Please sign in to comment.