@Override
    public HttpResponse handleException(ServiceRequestContext ctx, HttpRequest req, Throwable cause) {
        if (cause instanceof ValidationException) {
            final HttpStatus status = HttpStatus.BAD_REQUEST;
            return HttpResponse.ofJson(status, new ErrorResponse(status.reasonPhrase(),
                                                                 cause.getMessage(),
                                                                 req.path(),
                                                                 status.code(),
                                                                 Instant.now().toString()));
        }
        return ExceptionHandlerFunction.fallthrough();
    }
A sample exception handler which handles a {@link ValidationException}.
examples/spring-boot-minimal/src/main/java/example/springframework/boot/minimal/ValidationExceptionHandler.java