Ejemplo n.º 1
0
 @Override
 public Result onHandlerNotFound(RequestHeader r) {
   // usually one need to use a customized error reporting in production.
   //
   if (Play.application().isProd() || Play.application().isDev())
     return Results.notFound(JapidController.renderJapidWith("onHandlerNotFound.html", r));
   else return super.onHandlerNotFound(r);
 }
Ejemplo n.º 2
0
 public static Result toResult(RuntimeException re) {
   Logger.error("ERROR: ", re);
   String msg = re.getMessage();
   if (msg == null) {
     // api doesn't allow null strings
     msg = "";
   }
   re.printStackTrace();
   if (re instanceof NotFoundException) {
     return Results.notFound(msg);
   } else if (re instanceof ForbiddenException) {
     return Results.forbidden(msg);
   } else if (re instanceof IllegalStateException
       || re instanceof IllegalArgumentException
       || re instanceof UnsupportedOperationException
       || re instanceof PersistenceException) {
     return Results.badRequest(re.getMessage());
   }
   return Results.internalServerError(msg);
 }
Ejemplo n.º 3
0
 @Override
 public Result onHandlerNotFound(RequestHeader request) {
   AccessLogger.log(request, null, Http.Status.NOT_FOUND);
   return Results.notFound(ErrorViews.NotFound.render());
 }