Better error handling

This commit is contained in:
DD Liu 2018-07-12 17:18:38 -04:00
parent 004f38190a
commit 1c74c9028c

View file

@ -39,7 +39,7 @@ const loadBitmap_ = function (costume, costumeAsset, runtime, rotationCenter) {
const onError = function () { const onError = function () {
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
removeEventListeners(); removeEventListeners();
reject(); reject('Image load failed');
}; };
const onLoad = function () { const onLoad = function () {
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
@ -166,6 +166,9 @@ const loadCostume = function (md5ext, costume, runtime, optVersion) {
return runtime.storage.load(assetType, md5, ext).then(costumeAsset => { return runtime.storage.load(assetType, md5, ext).then(costumeAsset => {
costume.dataFormat = ext; costume.dataFormat = ext;
return loadCostumeFromAsset(costume, costumeAsset, runtime, optVersion); return loadCostumeFromAsset(costume, costumeAsset, runtime, optVersion);
})
.catch(e => {
log.error(e);
}); });
}; };