diff --git a/spec/schedulers/QueueScheduler-spec.ts b/spec/schedulers/QueueScheduler-spec.ts index 8c7f6f9219..2d0e9a0059 100644 --- a/spec/schedulers/QueueScheduler-spec.ts +++ b/spec/schedulers/QueueScheduler-spec.ts @@ -63,7 +63,7 @@ describe('Scheduler.queue', () => { const actions: Subscription[] = []; let action2Exec = false; let action3Exec = false; - let errorValue = undefined; + let errorValue: any = undefined; try { queue.schedule(() => { actions.push( diff --git a/spec/util/UnsubscriptionError-spec.ts b/spec/util/UnsubscriptionError-spec.ts index fc54c83332..5d9396a412 100644 --- a/spec/util/UnsubscriptionError-spec.ts +++ b/spec/util/UnsubscriptionError-spec.ts @@ -16,10 +16,13 @@ describe('UnsubscriptionError', () => { try { subscription.unsubscribe(); } catch (err) { - expect(err instanceof UnsubscriptionError).to.equal(true); - expect(err.errors).to.deep.equal([err1, err2]); - expect(err.name).to.equal('UnsubscriptionError'); - expect(err.stack).to.be.a('string'); + if (err instanceof UnsubscriptionError) { + expect(err.errors).to.deep.equal([err1, err2]); + expect(err.name).to.equal('UnsubscriptionError'); + expect(err.stack).to.be.a('string'); + } else { + throw new TypeError('Invalid error type'); + } } }); }); diff --git a/src/internal/scheduler/AsyncAction.ts b/src/internal/scheduler/AsyncAction.ts index 0731b7f166..f7d600472e 100644 --- a/src/internal/scheduler/AsyncAction.ts +++ b/src/internal/scheduler/AsyncAction.ts @@ -116,7 +116,10 @@ export class AsyncAction extends Action { this.work(state); } catch (e) { errored = true; - errorValue = (!!e && e) || new Error(e); + // HACK: Since code elsewhere is relying on the "truthiness" of the + // return here, we can't have it return "" or 0 or false. + // TODO: Clean this up when we refactor schedulers mid-version-8 or so. + errorValue = e ? e : new Error('Scheduled action threw falsy error'); } if (errored) { this.unsubscribe();