I have a custom error handler bound like this
bind [HttpErrorHandler] to injected [MyErrorHandler] ('router -> injectProvider[Router])
But my custom error handler isn't taking effect. For example, I have implemented the
onClientError method in my handler to render a custom page when a 404 occurs:
override def onClientError(request: RequestHeader, statusCode: Int, message: String = ""): Future[Result] = {
val result = if (statusCode == play.api.http.Status.NOT_FOUND) {
NotFound(
views.html.errors.handlerNotFound(request)
)
} ...
Future.successful(result)
}
But when I go to a nonexistent page, I get a Play error page instead of my own. Any ideas why my error handler isn't taking effect?
Thanks.