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

Refactor error handling #5206

Merged
merged 16 commits into from Oct 27, 2022
Merged

Refactor error handling #5206

merged 16 commits into from Oct 27, 2022

Conversation

Princesseuh
Copy link
Member

@Princesseuh Princesseuh commented Oct 26, 2022

Changes

This is a refactor of our error handling intended to bring the actual error handling closer to where the error actually happen instead of downstream.

The ideas being that by the different parts that can cause errors being more isolated, they'll be easier to test individually, it'll be easier to provide as much information as possible to users and eventually, will be easier to recover from (since we can know exactly what happened and where)

An easy example of the benefits is error code support, since we know precisely where the error happened, it's easy to apply a specific error code

This is the first part of a series of PRs and back-and-forth about errors, at the end of it, I'm hoping we'll have awesome and stylish errors!

Fix #5149
Fix #5153
Fix #5154

Testing

Our current error tests all pass!

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2022

🦋 Changeset detected

Latest commit: 6c6a182

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

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Oct 26, 2022
},
});

// Vite will handle creating the frame for us with proper line numbers, no need to create one
Copy link
Member Author

Choose a reason for hiding this comment

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

This took me by surprise while writing this PR, it turns out that Vite is able to create codeframes by itself whenever an error happens in parts it understands

Sometimes they're better than ours, sometimes not, luckily it checks if we already have one before doing it, so we can case by case it

@github-actions github-actions bot added the pkg: example Related to an example package (scope) label Oct 26, 2022
@github-actions github-actions bot removed the pkg: example Related to an example package (scope) label Oct 26, 2022
@Princesseuh Princesseuh changed the title [WIP] Refactor error handling Refactor error handling Oct 27, 2022
@Princesseuh Princesseuh marked this pull request as ready for review October 27, 2022 14:47
@Princesseuh Princesseuh merged commit d64d5b9 into main Oct 27, 2022
@Princesseuh Princesseuh deleted the handle-errors branch October 27, 2022 17:37
@astrobot-houston astrobot-houston mentioned this pull request Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
2 participants