-
Notifications
You must be signed in to change notification settings - Fork 64
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
[Discussion] Handling of errors #165
Comments
I totally agree with the first point. For the second, I have mixed feelings. On a frontend, you want to keep going as far as possible. It is not reasonable to error out on a parsing error, and potentially prevent a user from completing a purchase. On the other hand you want to catch such errors as soon as possible — in dev, or in tests. However, from experience silent errors were a real hinderance when undefined randomly cropped into different layers. |
Personally, I am a fan of erroring early. Ignoring a problem in an early stage with the hope of things turning out okay almost always causes problems down the line. That being said, I believe we can keep the optimistic behavior available using the custom error handler. People that want the old behavior can use Regardless of whether we change the default behavior, both points are a breaking change and will require a new major version. |
I want to start a discussion about error handling in the TypedJSON.
In my opinion, TypedJSON is too lax regarding default error behavior.
My proposal:
@jsonMember
, should always throw and not use the error handler.There errors are always the fault of a misconfiguration and I believe there to be no reason why you would ever want to keep that in your code.
errorHandler
should throw by default. We want to prevent new adopters from bugs silently creeping into their codebase. People that do not mind errors while (de)serializing can overwrite the error handler to go back to the old behavior.I'd love your opinion @Neos3452.
The text was updated successfully, but these errors were encountered: