/** * Invoked in dev mode when a server error occurs. Note that this method is where the URL set by play.editor is used. * <p> * The base implementation returns {@code Results.internalServerError} with the content of {@code views.html.defaultpages.devError}. * * @param request The request that triggered the error. * @param exception The exception. * @return a CompletionStage containing the Result. */ protected CompletionStage<Result> onDevServerError(RequestHeader request, UsefulException exception) { return CompletableFuture.completedFuture(Results.internalServerError(views.html.defaultpages.devError.render(playEditor, exception, request.asScala()))); }
/** * Invoked in dev mode when a server error occurs. Note that this method is where the URL set by play.editor is used. * <p> * The base implementation returns {@code Results.internalServerError} with the content of {@code views.html.defaultpages.devError}. * * @param request The request that triggered the error. * @param exception The exception. * @return a CompletionStage containing the Result. */ protected CompletionStage<Result> onDevServerError(RequestHeader request, UsefulException exception) { return CompletableFuture.completedFuture(Results.internalServerError(views.html.defaultpages.devError.render(playEditor, exception, request.asScala()))); }
/** * Invoked in dev mode when a server error occurs. Note that this method is where the URL set by play.editor is used. * <p> * The base implementation returns {@code Results.internalServerError} with the content of {@code views.html.defaultpages.devError}. * * @param request The request that triggered the error. * @param exception The exception. * @return a CompletionStage containing the Result. */ protected CompletionStage<Result> onDevServerError(RequestHeader request, UsefulException exception) { return CompletableFuture.completedFuture(Results.internalServerError(views.html.defaultpages.devError.render(playEditor, exception, request.asScala()))); }
/** * Invoked in dev mode when a server error occurs. * * @param request The request that triggered the error. * @param exception The exception. */ protected F.Promise<Result> onDevServerError(RequestHeader request, UsefulException exception) { return F.Promise.<Result>pure(Results.internalServerError(views.html.defaultpages.devError.render(playEditor, exception))); }
@Override protected CompletionStage<Result> onDevServerError(final Http.RequestHeader request, final UsefulException exception) { return Optional.ofNullable(exception.getCause()) .map(Throwable::getCause) .filter(e -> e instanceof ProvisionException) .map(e -> (ProvisionException) e) .filter(e -> e.getErrorMessages().stream().anyMatch(m -> m.getCause() instanceof SphereClientCredentialsException)) .map(e -> (CompletionStage<Result>) CompletableFuture.completedFuture(Results.internalServerError(views.html.defaultpages.devError.render(playEditor, new SphereCredentialsUsefulException(exception))))) .orElseGet(() -> super.onDevServerError(request, exception)); }