ahly212
ahly212

Reputation: 106

Custom handling for error 500 in playframework2(java)?

In my Routes file i have done something like- GET /error Controllers.error.Error()

But it is giving compilation error. In my error.java i have done something like,

Public static error Error(Throwable t) 
{
Return internalservererror(views.html.myerrorpage.render())
}

I want to know what to write in routes file for error 500, and i also wanted to know whether server will keep a log of the errors occured, How it works?

Thanks in advance.

Upvotes: 0

Views: 900

Answers (1)

i.am.michiel
i.am.michiel

Reputation: 10404

You can override those in the Global object.

EDIT : with the controlled URL.

GlobalScala :

override def onError(request: RequestHeader, ex: Throwable) = {
   Redirect(routes.ErrorHandler.error())
}  

routes :

GET /error      controllers.ErrorHandler.error()

Upvotes: 1

Related Questions