Reputation: 5629
Playframework displays a whole list of all available routes if you call a wrong route. that looks like that:
Is there a way to deactivate this listing?
Thanks in advance.
Upvotes: 1
Views: 83
Reputation: 8263
It does this only in the development mode, it's for easy debugging.
In the production mode, the list would be empty.
Upvotes: 2
Reputation: 1459
Play provides the default error handling mechanism
You can override the onClientError
override def onClientError(request: RequestHeader, statusCode: Int, message: String): Future[Result] =
statusCode match {
case NOT_FOUND =>
Future.successful {
NotFound(Json.obj("error" -> s"Resource ${request.uri} is invalid"))//or whatever error message you want.
}
}
Upvotes: 1