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: catch unhandled errors in fromNext #17

Merged
merged 2 commits into from
May 7, 2024
Merged

Conversation

andogq
Copy link
Member

@andogq andogq commented May 7, 2024

Ensure that any errors thrown within the handler passed to fromNext are caught and emitted as unknown atoms.

Example

let thrown = false;
const s = $.fromNext(() => {
    if (!thrown) {
        thrown = true;
        throw "error";
    }

    return StreamEnd;
});

await s.toArray({ atoms: true });
// Produces: [unknown("error")]

@andogq andogq added the bug Something isn't working label May 7, 2024
@andogq andogq requested a review from giraugh May 7, 2024 01:48
@andogq andogq self-assigned this May 7, 2024
Copy link

changeset-bot bot commented May 7, 2024

🦋 Changeset detected

Latest commit: af01d2f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
windpipe Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@andogq andogq requested a review from mdboon May 7, 2024 02:06
Copy link
Contributor

@giraugh giraugh left a comment

Choose a reason for hiding this comment

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

LGTM!

@andogq andogq force-pushed the fix/unhandled-next-function branch from 3847033 to af01d2f Compare May 7, 2024 06:12
@andogq andogq merged commit ebd7c47 into main May 7, 2024
1 check passed
@andogq andogq deleted the fix/unhandled-next-function branch May 7, 2024 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants