|
@@ -213,31 +213,30 @@ public class CustomExceptionHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ HttpStatus httpStatus = null;
|
|
|
if (alwaysOK) {
|
|
|
- INTERFACE_LOG.error("[HTTP-RESP]. status=" + HttpStatus.OK.value());
|
|
|
- if (printStackTrace) {
|
|
|
- INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body), t);
|
|
|
- } else {
|
|
|
- INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body));
|
|
|
- }
|
|
|
if (t instanceof ApiFlowLimitedException) {
|
|
|
- return new ResponseEntity<StatusResponse>(body, HttpStatus.SERVICE_UNAVAILABLE);
|
|
|
+ httpStatus = HttpStatus.SERVICE_UNAVAILABLE;
|
|
|
} else {
|
|
|
- return new ResponseEntity<StatusResponse>(body, HttpStatus.OK);
|
|
|
+ httpStatus = HttpStatus.OK;
|
|
|
}
|
|
|
} else {
|
|
|
- INTERFACE_LOG.error("[HTTP-RESP]. status=" + HttpStatus.INTERNAL_SERVER_ERROR.value());
|
|
|
- if (printStackTrace) {
|
|
|
- INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body), t);
|
|
|
- } else {
|
|
|
- INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body));
|
|
|
- }
|
|
|
if (t instanceof ApiFlowLimitedException) {
|
|
|
- return new ResponseEntity<StatusResponse>(body, HttpStatus.SERVICE_UNAVAILABLE);
|
|
|
+ httpStatus = HttpStatus.SERVICE_UNAVAILABLE;
|
|
|
} else {
|
|
|
- return new ResponseEntity<StatusResponse>(body, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ INTERFACE_LOG.error("[HTTP-RESP]. status=" + httpStatus.value());
|
|
|
+
|
|
|
+ if (printStackTrace) {
|
|
|
+ INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body), t);
|
|
|
+ } else {
|
|
|
+ INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body));
|
|
|
+ }
|
|
|
+
|
|
|
+ return new ResponseEntity<StatusResponse>(body, httpStatus);
|
|
|
}
|
|
|
|
|
|
/**
|