Created
January 10, 2021 23:05
-
-
Save hadilq/b4fb6fa137faa063cd4b2f589a7f6fff to your computer and use it in GitHub Desktop.
Validate in doWork method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doWork() : Result<Email> { | |
... | |
validate() elseIf { | |
InvalidEmailAddress { errorMessage: String -> | |
return Failure(errorMessage) | |
} | |
EmptySubject { errorMessage: String -> /* handle failure */ } | |
EmptyBody { errorMessage: String -> /* handle failure */ } | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment