Skip to content

throw errors rather than resolving them #87

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

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

keithamus
Copy link
Contributor

@lgarron a slight change in the API to be more idiomatic (and also backwards compatible).

Instead of returning Error objects, we throw them so the Promise rejects.

@keithamus keithamus requested a review from a team as a code owner December 1, 2022 09:42
@keithamus keithamus merged commit 5dfb899 into main Dec 1, 2022
@keithamus keithamus deleted the throw-errors-rather-than-resolving-them branch December 1, 2022 09:47
@lgarron
Copy link
Contributor

lgarron commented Dec 2, 2022

Ah, it looks like I misunderstood what

privateData.set(this, {src, data})
was trying to do. I certainly agree that throwing is more idiomatic than returning.

Thanks for the fix!

Comment on lines 199 to 201
if (data instanceof Error) {
return data
throw data
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This might now be unreachable and safe to remove?

lgarron added a commit that referenced this pull request Dec 2, 2022
lgarron added a commit that referenced this pull request Dec 2, 2022
lgarron added a commit that referenced this pull request Dec 2, 2022
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.

3 participants