Return error with Must instead of a boolean #6
Closed
AndreuCodina
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
C# doesn't have sum types, so currently we have to specify the error before a
Must
, and return a boolean:Instead of a boolean, we can add method overloads (for Must and MustAsync) to return the error as nullable:
or
Another option can be return void/Task and catch a possible exception:
Benefits:
Considerations:
ValidationError
andEnsureError
.Beta Was this translation helpful? Give feedback.
All reactions