Created
January 9, 2016 18:31
-
-
Save dkomanov/eb3c043a1752c9c4ab31 to your computer and use it in GitHub Desktop.
[scala] result code: either with some implicits
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
def processRequestNew(userId: UUID, requestId: UUID): BusinessResult = { | |
for { | |
user <- getUser(userId) orResult BusinessResult.UserNotFound | |
request <- getRequestById(requestId) orResult BusinessResult.RequestNotFound | |
_ <- checkAccess(request, user) orResult BusinessResult.NotOwner | |
} yield BusinessResult.Ok | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment