Skip to content

Commit

Permalink
Allow image loads to fail without crashing render
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh committed Aug 3, 2017
1 parent b3db735 commit b8450f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ImageLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ export default class ImageLoader {

ready(): Promise<ImageStore> {
const keys = Object.keys(this.cache);
return Promise.all(keys.map(str => this.cache[str])).then(images => {
return Promise.all(keys.map(str => this.cache[str].catch(e => {
if (__DEV__) {
this.logger.log(`Unable to load image`, e);
}
}))).then(images => {
if (__DEV__) {
this.logger.log('Finished loading images', images);
}
Expand Down

0 comments on commit b8450f4

Please sign in to comment.