chore: error handling

This commit is contained in:
cha0s 2020-06-21 11:22:10 -05:00
parent 5f701f1525
commit a906073b91
3 changed files with 13 additions and 5 deletions

View File

@ -80,6 +80,8 @@ export class Resource extends decorate(class {}) {
});
}
return json;
}).catch((error) => {
console.error(`Failed loading '${uri}'.`);
});
}

View File

@ -13,11 +13,13 @@ export class AnimationView extends Renderable {
this.animation = animation;
this.container = new Container();
if (hasGraphics) {
Image.load(this.animation.imageUri).then((image) => {
this.sprite = new Sprite(image);
this.container.addChild(this.sprite);
this.resetSourceRectangle();
});
if (this.animation.imageUri) {
Image.load(this.animation.imageUri).then((image) => {
this.sprite = new Sprite(image);
this.container.addChild(this.sprite);
this.resetSourceRectangle();
});
}
}
animation.on(
['directionChanged', 'indexChanged'],

View File

@ -128,6 +128,8 @@ export default class Animated extends decorate(Trait) {
});
// Bounding box update.
this.entity.updateVisibleBoundingBox();
}).catch((error) => {
console.error(`Failed loading some or all animations.`);
});
}
@ -156,6 +158,8 @@ export default class Animated extends decorate(Trait) {
}
});
this.setSpriteScale();
}).catch((error) => {
console.error(`Failed loading some or all animation images.`);
});
}