添加更多异常处理

This commit is contained in:
Harvey Zack committed 2018-12-05 16:09:37 +08:00
1 parent 6d3e0b4567
commit 156519546f
2 files changed
+19 -4

No files matched your search

+11 -1
View File
@@ -270,6 +270,8 @@
sleep(delay).then(function () { sleep(delay).then(function () {
_this3.emit('video', _this3.video); _this3.emit('video', _this3.video);
}).catch(function (err) { }).catch(function (err) {
_this3.emit('error', err.message);
console.error(err); console.error(err);
}); });
} }
@@ -309,14 +311,22 @@
}); });
this.processing = true; this.processing = true;
runPromisesInSeries(promiseList).then(function () { runPromisesInSeries(promiseList).then(function () {
sleep(delay * 2).then(function () { return sleep(delay * 2).then(function () {
_this4.processing = false; _this4.processing = false;
_this4.emit('done'); _this4.emit('done');
}).catch(function (err) { }).catch(function (err) {
_this4.processing = false;
_this4.emit('error', err.message);
console.error(err); console.error(err);
}); });
}).catch(function (err) { }).catch(function (err) {
_this4.processing = false;
_this4.emit('error', err.message);
console.error(err); console.error(err);
}); });
} }
@@ -73,6 +73,7 @@ class ArtplayerToolThumbnail extends Emitter {
this.emit('video', this.video); this.emit('video', this.video);
}) })
.catch(err => { .catch(err => {
this.emit('error', err.message);
console.error(err); console.error(err);
}); });
} }
@@ -104,17 +105,21 @@ class ArtplayerToolThumbnail extends Emitter {
}); });
this.processing = true; this.processing = true;
runPromisesInSeries(promiseList) runPromisesInSeries(promiseList)
.then(() => { .then(() =>
sleep(delay * 2) sleep(delay * 2)
.then(() => { .then(() => {
this.processing = false; this.processing = false;
this.emit('done'); this.emit('done');
}) })
.catch(err => { .catch(err => {
this.processing = false;
this.emit('error', err.message);
console.error(err); console.error(err);
}); }),
}) )
.catch(err => { .catch(err => {
this.processing = false;
this.emit('error', err.message);
console.error(err); console.error(err);
}); });
} }