tao.mo

common-dependencies | 修改 |

日志输出调整
mt
2025年4月1日18:44:30
......@@ -3,16 +3,19 @@ package com.fedex.connect.common.dependencies.config;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.dependencies.exception.BaseException;
import com.fedex.connect.common.dependencies.exception.OpErrorException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@Slf4j
@ConditionalOnProperty(prefix = "common.exception-advice-webconfig", name = "enable", havingValue = "true")
@RestControllerAdvice
public class ControllerExceptionAdvice {
@ExceptionHandler(Exception.class)
public ResponseVo exceptionHandler(Exception ex) {
log.error(ex.getMessage(),ex);
ResponseVo res = new ResponseVo();
res.setSuccess(false);
res.setCode(599);
......@@ -22,6 +25,7 @@ public class ControllerExceptionAdvice {
@ExceptionHandler(BaseException.class)
public ResponseVo baseExceptionHandler(BaseException ex) {
log.error(ex.getMessage(),ex);
ResponseVo res = new ResponseVo();
res.setSuccess(false);
res.setCode(ex.getCode().intValue());
......@@ -31,6 +35,7 @@ public class ControllerExceptionAdvice {
@ExceptionHandler(OpErrorException.class)
public ResponseVo opErrorExceptionHandler(OpErrorException ex) {
log.error(ex.getMessage(),ex);
ResponseVo res = new ResponseVo();
res.setSuccess(false);
res.setCode(ex.getCode());
......