|
@@ -5,6 +5,7 @@ import com.backendsys.utils.response.Result;
|
|
|
import com.backendsys.utils.response.ResultEnum;
|
|
|
import jakarta.validation.ConstraintViolation;
|
|
|
import jakarta.validation.ConstraintViolationException;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.ibatis.exceptions.PersistenceException;
|
|
|
import org.apache.ibatis.exceptions.TooManyResultsException;
|
|
|
import org.mybatis.spring.MyBatisSystemException;
|
|
@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
|
|
|
* 待看
|
|
|
*/
|
|
|
|
|
|
+@Slf4j
|
|
|
@RestControllerAdvice
|
|
|
public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
|
|
|
@Autowired
|
|
@@ -142,7 +144,8 @@ public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
|
|
|
public Result handleCustomException(CustomException e) {
|
|
|
System.out.println("****** CustomException.class: ******");
|
|
|
System.out.println(e);
|
|
|
- return Result.error(e.getErrorCode() != null ? e.getErrorCode() : ResultEnum.PARAMETER_EXCEPTION.getCode(), e.getMessage(), e.getErrorObject() );
|
|
|
+ log.info(e.getMessage());
|
|
|
+ return Result.error(e.getErrorCode() != null ? e.getErrorCode() : ResultEnum.PARAMETER_EXCEPTION.getCode(), e.getMessage(), e.getErrorObject());
|
|
|
}
|
|
|
/**
|
|
|
* 自定义异常类 (仅返回文本)
|