- if (t instanceof ServiceException) {
- String errorMessage = prepareBadOperationErrorMessage(t, origianalMessage);
- return sendDmaapResponse(errorMessage, dmaapRequestMessage, HttpStatus.NOT_FOUND) //
- .flatMap(notUsed -> Mono.empty());
- } else {
- return sendDmaapResponse(t.toString(), dmaapRequestMessage, HttpStatus.NOT_FOUND) //
- .flatMap(notUsed -> Mono.empty());
+ HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
+ String errorMessage = t.getMessage();
+ if (t instanceof WebClientResponseException) {
+ WebClientResponseException exception = (WebClientResponseException) t;
+ status = exception.getStatusCode();
+ errorMessage = exception.getResponseBodyAsString();
+ } else if (t instanceof ServiceException) {
+ status = HttpStatus.BAD_REQUEST;
+ errorMessage = prepareBadOperationErrorMessage(t, originalMessage);
+ } else if (!(t instanceof WebClientException)) {
+ logger.warn("Unexpected exception ", t);