Skip to content

Instantly share code, notes, and snippets.

@jto
Created May 23, 2013 19:21
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 jto/5638714 to your computer and use it in GitHub Desktop.
Save jto/5638714 to your computer and use it in GitHub Desktop.
val (untaggedRequestHeader, handler) = Exception
.allCatch[RequestHeader].either(tryToCreateRequest)
.fold(
e => {
val rh = createRequestHeader()
val r = server.applicationProvider.get.fold(e => DefaultGlobal, a => a.global).onBadRequest(rh, e.getMessage)
(rh, Left(r))
},
rh => (rh, server.getHandlerFor(rh)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment