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

Improve error recovery #705

Merged
merged 7 commits into from
Jan 17, 2023
Merged

Improve error recovery #705

merged 7 commits into from
Jan 17, 2023

Conversation

natemoo-re
Copy link
Member

@natemoo-re natemoo-re commented Jan 15, 2023

Changes

  • This adds some logic to intercept and format panics so that we actually reject the transform promise with the correct error instead of just printing the error to stdout.
  • Trims irrelevant info from the stacktrace and formats to more helpful internal file location.
  • Formats errors similarly to JS stacktraces so that they don't confuse users
  • Related to Remove legacy compiler error handling astro#5855

Testing

Tested manually

Before After
old stacktrace new stacktrace

Docs

N/A, QoL improvement

@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2023

🦋 Changeset detected

Latest commit: fe86fa9

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

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler Minor

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

internal_wasm/utils/utils.go Outdated Show resolved Hide resolved
@Princesseuh
Copy link
Member

I'm not sure how I feel about the stacktrace being JS like. Even though those are nicer than Go's, I feel like modifying "technical" information can lead to more problems unnecessarily. Sure, they don't scare users as much, but someone used to Go's stacktraces will just find it weird (+ I'm guessing you can't CTRL+click them like you'd do with JS's)

@natemoo-re
Copy link
Member Author

Alright, thanks for the comments! After thinking about it, I totally agree that transforming the stacktraces is probably going to cause more issues than it will help, so I've removed that logic in c584433.

Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

Looks amazing, so nice to see the error in the new overlay!

@natemoo-re natemoo-re merged commit 1adac72 into main Jan 17, 2023
@natemoo-re natemoo-re deleted the feat/better-error-recovery branch January 17, 2023 15:02
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