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

Include a custom error class to differentiate unexpected errors #8

Open
tmcw opened this issue Oct 30, 2023 · 1 comment
Open

Include a custom error class to differentiate unexpected errors #8

tmcw opened this issue Oct 30, 2023 · 1 comment

Comments

@tmcw
Copy link

tmcw commented Oct 30, 2023

dprint will throw an error if the input code has bad syntax, but there are presumably other errors that can be thrown by the module too. It'd be nice if there was a custom Error subclass that was used & exported so that downstream applications can decide which errors to log and send to error tracking systems or show to users, and which errors are expected and just the result of bad syntax.

@dsherret
Copy link
Member

dsherret commented Oct 30, 2023

dprint will throw an error if the input code has bad syntax, but there are presumably other errors that can be thrown by the module too.

I think right now the only errors it surfaces are ones to show to users (bad syntax). Maybe I'm misremembering something, but I think just forwarding all errors to the user should be fine.

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

No branches or pull requests

2 participants