nutype
nutype copied to clipboard
Support custom errors
Context
Some orgs and people are not quite happy with auto-generated error types, e.g. it's not possible to customize them, inject extra details, etc.
Requirement
Provide a way for users to:
- Define and provide error type they want to use
- Inject their custom validation function that would return
Result<(), CustomError>, whereCustomErroris a user defined error.
Technically it's possible, but the syntax for this needs to be decided.
Consideration
Having this may clash with "unified error": https://github.com/greyblake/nutype/issues/75, so requires careful thinking.