That's what ExceptionHandler is for in Akka HTTP:
more docs here: 
http://doc.akka.io/docs/akka/2.4.4/scala/http/routing-dsl/directives/execution-directives/handleExceptions.html#description

Happy hakking!

-- 
Konrad `ktoso` Malawski
Akka @ Lightbend

On 20 April 2016 at 00:49:49, Edmondo Porcu (edmondo.po...@gottexbrokers.com) 
wrote:

Hello,

I have a route like the following 

post{
  complete {
    (actor ? msg).mapTo[AResult]
  }
}

When my future fails, a generic exception is returned to the client and I would 
like to have more control on that. Recovering the future with a error message 
doesn't seem a good idea because it will then be marshalled as a correct result 
(200?).  How can customize the exception handling, maybe to tailor-made my 
behaviour depending on the exception type?

Thank you

Edmondo
--
>>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to