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 handling #12

Open
stoically opened this issue Jan 5, 2021 · 3 comments
Open

Improve error handling #12

stoically opened this issue Jan 5, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@stoically
Copy link
Owner

stoically commented Jan 5, 2021

Currently syn-rsx hardcodes error strings, which might not fit into what consumers expect. Also some errors lack context information to allow consumers to properly show errors. It'd probably be more elegant to instead have a custom Error with sensible context information (some sort of Enum) and an useful Span, maybe if possible with some default error strings as convenience fallback.

@stoically stoically added the enhancement New feature or request label Jan 5, 2021
@stoically
Copy link
Owner Author

https://docs.rs/error-stack in combination with thiserror looks promising for this task.

@stoically
Copy link
Owner Author

If possible it'd be nice to attach the Node to the error-stack report.

@stoically
Copy link
Owner Author

syn always expects a syn::Error to be returned from a parser struct / closure. So currently I don't see a way to expose a custom error to consumers. Only workaround seems to be allowing to set custom error display strings via configuration.

Upstream issue: dtolnay/syn#1239

dezren39 pushed a commit to dezren39/syn-rsx that referenced this issue Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant