Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Schedulers): Throwing a falsy error in a scheduled function no longer results in strange error objects. #6594

Merged
merged 2 commits into from
Sep 14, 2021

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Sep 14, 2021

Because TS 4.4 now infers unknown for catch blocks, we had to make some adjustments.

This also helped us catch a type problem where we were maybe creating new Error(false) or new Error(''), etc, in some cases.

@@ -63,7 +63,7 @@ describe('Scheduler.queue', () => {
const actions: Subscription[] = [];
let action2Exec = false;
let action3Exec = false;
let errorValue = undefined;
let errorValue: any = undefined;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix CI ts@latest

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) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix CI ts@latest

// 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('Falsy action error');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix CI ts@latest and correct a weird bit of code that TS 4.4 helped catch.

@benlesh benlesh merged commit c70fcc0 into ReactiveX:master Sep 14, 2021
@benlesh benlesh deleted the fix-ts-4-4-build branch September 14, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants