Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
martind260 committed Jul 19, 2024
1 parent 365ad13 commit 6ebd70f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/de/muenchen/mobidam/s3/S3RouteBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public void configure() {
.process(exchange -> {
Exception exception = (Exception) exchange.getAllProperties().get(Exchange.EXCEPTION_CAUGHT);
// even with onException(S3Exception), the transported exception may still be sth. else:
if (((Throwable)exchange.getAllProperties().get(Exchange.EXCEPTION_CAUGHT)).getCause() instanceof S3Exception s3Exception){
if (((Throwable) exchange.getAllProperties().get(Exchange.EXCEPTION_CAUGHT)).getCause()instanceof S3Exception s3Exception) {
exception = s3Exception;
}
logException(exchange, exception);
var statusCode = HttpStatus.BAD_REQUEST.value();
if (exception instanceof S3Exception s3Exception){
if (exception instanceof S3Exception s3Exception) {
statusCode = s3Exception.statusCode();
}
exchange.getMessage().setBody(ErrorResponseBuilder.build(statusCode, exception.getClass().getName()));
Expand All @@ -55,7 +55,7 @@ public void configure() {
ErrorResponse res = ErrorResponseBuilder.build(HttpStatus.INTERNAL_SERVER_ERROR.value(), exception.getClass().getName());
exchange.getMessage().setBody(res);
}
exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, ((ErrorResponse)exchange.getMessage().getBody()).getStatus());
exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, ((ErrorResponse) exchange.getMessage().getBody()).getStatus());
});

from("{{camel.route.common}}")
Expand Down

0 comments on commit 6ebd70f

Please sign in to comment.