Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[scala] result code: either with some implicits
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