greyblake / nutype

Rust newtype with guarantees 🇺🇦 🦀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should define a Error type rather than generate error type for every struct

yjhmelody opened this issue · comments

commented

The generated error type is not very useful.

The idea of a specific error for every particular struct is that:

  • Looking at the definition of error type one can easily say which validation rules are there
  • It enables exhaustive error handling

In the further versions I am planning to introduce something like GenericValidationError, so every specific validation error will be convertable into GenericValidationError