|
@@ -6,7 +6,6 @@ import com.usky.common.core.exception.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.converter.HttpMessageNotReadableException;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -19,6 +18,7 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
+import org.springframework.web.context.request.WebRequest;
|
|
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
|
|
import org.yaml.snakeyaml.constructor.DuplicateKeyException;
|
|
|
|
|
@@ -245,6 +245,18 @@ public class UnifiedExceptionHandler {
|
|
|
return handleBusinessException(be);
|
|
|
}
|
|
|
|
|
|
+ @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
+ @ResponseBody
|
|
|
+ @ExceptionHandler(value = {FeignBadRequestException.class})
|
|
|
+ public ApiResult<Void> handleFeignException(FeignBadRequestException ex, WebRequest request) {
|
|
|
+ ErrorCode errorCode = ErrorCode.create(SystemErrorCode.SYS_SYSTEM_FEIGN_RESULT_DECODE_ERROR.getCode(),
|
|
|
+ SystemErrorCode.SYS_SYSTEM_FEIGN_RESULT_DECODE_ERROR.getDefaultMessage());
|
|
|
+ BusinessException be = new BusinessException(errorCode, ex.getMessage());
|
|
|
+ return handleBusinessException(be);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private void logError(ErrorCode errorCode, Throwable t, boolean isSystemError) {
|
|
|
String logTemplate = isSystemError ? SYS_ERROR_LOG_MESSAGE_TEMPLATE : BIZ_ERROR_LOG_MESSAGE_TEMPLATE;
|
|
|
LOGGER.error(String.format(logTemplate,
|