I'm trying to create route that would wrap caught exception into my 
exception that carries user object of logged-in user. Ideally I prefer to 
put that information into ContextRequest in order to use it in my 
ExceptionHandler but it's immutable.


I concluded that the right way to do it is to use mapInnerRoute as 
described in this example 
<http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/routing-dsl/directives/basic-directives/mapInnerRoute.html#Example>
.


def completeWithUserAwareException(user: User) =
  mapInnerRoute { route =>
    ctx =>
      try {
        route(ctx)
      } catch {
        case ex: Throwable =>
          ctx.fail(new ExceptionWithUser(user, 0, ex))
      }
  }


which I use like this


val authenticatedRoutes = myAuthorization { user =>
    completeWithUserAwareException(user) {
    pathPrefix("admin") {
      (get & path("plugins")) {
          complete {
            ""
          }
      }
    }
  }}


Content of completeWithUserAwareException is never invoked. I suspect it 
has something to do with dynamic nature of outer route.


How can I achieve my goal of passing user context information to exception 
handler ?

SO question is here 
: http://stackoverflow.com/questions/32969554/mapinnerroute-is-not-working

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to