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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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