js-formatter
js-formatter copied to clipboard
Include a custom error class to differentiate unexpected errors
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.
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.