Skip to content

Instantly share code, notes, and snippets.

@dkomanov
Created January 9, 2016 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkomanov/f6b520dae959a3e20c85 to your computer and use it in GitHub Desktop.
Save dkomanov/f6b520dae959a3e20c85 to your computer and use it in GitHub Desktop.
[scala] result code: old java style
def processRequestOld(userId: UUID, requestId: UUID): BusinessResult = {
val userOpt = getUser(userId)
if (userOpt.isEmpty) {
return BusinessResult.UserNotFound
}
val requestOpt = getRequestById(requestId)
if (requestOpt.isEmpty) {
return BusinessResult.RequestNotFound
}
if (checkAccess(requestOpt.get, userOpt.get).isFailure) {
return BusinessResult.NotOwner
}
BusinessResult.Ok
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment