chore: error handling
This commit is contained in:
parent
5f701f1525
commit
a906073b91
|
@ -80,6 +80,8 @@ export class Resource extends decorate(class {}) {
|
|||
});
|
||||
}
|
||||
return json;
|
||||
}).catch((error) => {
|
||||
console.error(`Failed loading '${uri}'.`);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -13,12 +13,14 @@ export class AnimationView extends Renderable {
|
|||
this.animation = animation;
|
||||
this.container = new Container();
|
||||
if (hasGraphics) {
|
||||
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'],
|
||||
this.onAnimationChanged,
|
||||
|
|
|
@ -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.`);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user