Skip to content

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

3 participants