I am developing a REST API using play framework. I would like to implement a centralized error handling for all my actions.
What is the best way to achieve this?
You should have a look at the
Especially, it allows you to override:
def onError(request: RequestHeader, ex: Throwable) def onHandlerNotFound(request: RequestHeader) def onBadRequest(request: RequestHeader, error: String)
onError is probably the one you are looking for, but the others may be useful too :)