Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[writing-async-app-in-scala-part-1] naive rewrite to async
def regularRpcEndpoint(request: Request): Future[Response] = {
validateRequest(request)
isPermittedViaRpc.flatMap { isPermitted =>
if (!isPermitted) {
Future.failed(new PermissionDeniedException("..."))
} else {
retrieveFromDatabase(request.id)
.map(convertPayloadFromDb)
.map(Response)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment