fix: properly handle non ticking promises and errors

This commit is contained in:
cha0s 2019-05-27 21:51:39 -05:00
parent 3503f0fd01
commit de88478016

View File

@ -36,12 +36,13 @@ export class Actions extends decorate(Traversals) {
this.emitFinished();
return;
}
if (
this.pending
&& this.pending instanceof TickingPromise
&& 'function' === typeof this.pending.ticker
) {
this.pending.ticker(elapsed);
if (this.pending) {
if (
this.pending instanceof TickingPromise
&& 'function' === typeof this.pending.ticker
) {
this.pending.ticker(elapsed);
}
return;
}
@ -50,9 +51,12 @@ export class Actions extends decorate(Traversals) {
while (true) {
const result = this.traversals[this.index].traverse(context);
if (result instanceof Promise) {
result.then(() => this.prologue());
result.then(() => {
this.prologue();
});
result.catch((error) => {
throw error;
console.error(error);
this.prologue();
});
this.pending = result;
break;