Allow image loads to fail without crashing render

This commit is contained in:
Niklas von Hertzen 2017-08-03 23:54:23 +08:00
parent b3db735415
commit b8450f4d4a

View File

@ -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);
}