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: make compiler error extend from Error #14036

Merged
merged 1 commit into from
Oct 30, 2024
Merged

fix: make compiler error extend from Error #14036

merged 1 commit into from
Oct 30, 2024

Conversation

dummdidumm
Copy link
Member

We originally didn't extend from Error anymore because its fields are of no real value to us, and has problems with serialization in a worker context.

Turns out this was a mistake, because various build tools rely on errors being thrown as something that extends Error, else they try to wrap it in their own error.

We therefore revert that change while still trying to preserve most of the advantages of not extending Error, namely nuking the useless stack trace and making sure the message is enumerable.

Copy link

changeset-bot bot commented Oct 30, 2024

🦋 Changeset detected

Latest commit: 47b11b4

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

This PR includes changesets to release 1 package
Name Type
svelte 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

Copy link

pkg-pr-new bot commented Oct 30, 2024

pnpm add https://pkg.pr.new/svelte@14036

commit: 47b11b4

We originally didn't extend from `Error` anymore because its fields are of no real value to us, and has problems with serialization in a worker context.

Turns out this was a mistake, because various build tools rely on errors being thrown as something that extends Error, else they try to wrap it in their own error.

We therefore revert that change while still trying to preserve most of the advantages of not extending `Error`, namely nuking the useless stack trace and making sure the message is enumerable.
@trueadm
Copy link
Contributor

trueadm commented Oct 30, 2024

Can't we do static [Symbol.hasInstance](instance) and return true for Error?

@dummdidumm
Copy link
Member Author

We probably could but I'm a bit worried if that breaks things in other places, like code expecting Error functionality from that class that it doesn't have and then breaking in weird ways

@dummdidumm dummdidumm merged commit 1434f48 into main Oct 30, 2024
10 checks passed
@dummdidumm dummdidumm deleted the compiler-error branch October 30, 2024 14:33
@github-actions github-actions bot mentioned this pull request Oct 30, 2024
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.

None yet

4 participants