logger.debug("{} HTTP error status = '{}', body '{}'", traceTag, exception.getStatusCode(),
exception.getResponseBodyAsString());
} else {
- logger.debug("{} HTTP error: {}", traceTag, t.getMessage());
+ logger.debug("{} HTTP error", traceTag, t);
}
}
RejectionException e = new RejectionException("Policy cannot change RIC, policyId: " + current.id() + //
", RIC name: " + current.ric().name() + //
", new name: " + policy.ric().name(), HttpStatus.CONFLICT);
+ logger.debug("Request rejected, {}", e);
return Mono.error(e);
}
return Mono.just("OK");
private Mono<Object> checkSupportedType(Ric ric, PolicyType type) {
if (!ric.isSupportingType(type.name())) {
+ logger.debug("Request rejected, type not supported, RIC: {}", ric);
RejectionException e = new RejectionException(
"Type: " + type.name() + " not supported by RIC: " + ric.name(), HttpStatus.NOT_FOUND);
return Mono.error(e);
if (ric.getState() == Ric.RicState.AVAILABLE) {
return Mono.just("OK");
} else {
+ logger.debug("Request rejected RIC not IDLE, ric: {}", ric);
RejectionException e = new RejectionException(
"Ric is not operational, RIC name: " + ric.name() + ", state: " + ric.getState(), HttpStatus.LOCKED);
return Mono.error(e);
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import org.springframework.web.reactive.function.client.WebClientException;
import org.springframework.web.reactive.function.client.WebClientResponseException;
import reactor.core.publisher.Mono;
private Mono<ResponseEntity<String>> handleAgentCallError(Throwable t, String originalMessage,
DmaapRequestMessage dmaapRequestMessage) {
logger.debug("Agent call failed: {}", t.getMessage());
- HttpStatus status = HttpStatus.NOT_FOUND;
+ HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
String errorMessage = t.getMessage();
if (t instanceof WebClientResponseException) {
WebClientResponseException exception = (WebClientResponseException) t;
} else if (t instanceof ServiceException) {
status = HttpStatus.BAD_REQUEST;
errorMessage = prepareBadOperationErrorMessage(t, originalMessage);
-
+ } else if (!(t instanceof WebClientException)) {
+ logger.warn("Unexpected exception ", t);
}
return sendDmaapResponse(errorMessage, dmaapRequestMessage, status) //
.flatMap(notUsed -> Mono.empty());
} else {
return Mono.error(new ServiceException("Not implemented operation: " + operation));
}
-
}
private String payload(DmaapRequestMessage message) {