|
@@ -1,42 +1,42 @@
|
|
|
-//package edu.travel.education.exception;
|
|
|
-//
|
|
|
-//import edu.travel.emun.ResponseCode;
|
|
|
-//import edu.travel.exception.BaseException;
|
|
|
-//import edu.travel.resp.BaseResponse;
|
|
|
-//import edu.travel.resp.PageResponse;
|
|
|
-//import lombok.extern.slf4j.Slf4j;
|
|
|
-//import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
-//import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * GlobalExceptionHandler 类。
|
|
|
-// * <p>
|
|
|
-// * 描述:
|
|
|
-// *
|
|
|
-// * @author huangwenwen
|
|
|
-// * @date 2025/2/11
|
|
|
-// */
|
|
|
-//
|
|
|
-//@RestControllerAdvice
|
|
|
-//@Slf4j
|
|
|
-//public class GlobalExceptionHandler {
|
|
|
-//
|
|
|
-// @ExceptionHandler(BaseException.class)
|
|
|
-// public BaseResponse<Object> handleUserInfoException(BaseException e){
|
|
|
-// e.printStackTrace();
|
|
|
-// return PageResponse.out(e.getCode(),e.getMessage(),null);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ExceptionHandler(IllegalArgumentException.class)
|
|
|
-// public BaseResponse<Object> handleException(IllegalArgumentException e){
|
|
|
-// e.printStackTrace();
|
|
|
-// return PageResponse.out(ResponseCode.LOGIC_ERROR.getCode(), e.getMessage(),null);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ExceptionHandler(Throwable.class)
|
|
|
-// public BaseResponse<Object> handleException(Exception e){
|
|
|
-// e.printStackTrace();
|
|
|
-// return PageResponse.out(ResponseCode.ERROR.getCode(),e.getMessage(),null);
|
|
|
-// }
|
|
|
-//
|
|
|
-//}
|
|
|
+package edu.travel.education.exception;
|
|
|
+
|
|
|
+import edu.travel.emun.ResponseCode;
|
|
|
+import edu.travel.exception.BaseException;
|
|
|
+import edu.travel.resp.BaseResponse;
|
|
|
+import edu.travel.resp.PageResponse;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
+import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
|
+
|
|
|
+/**
|
|
|
+ * GlobalExceptionHandler 类。
|
|
|
+ * <p>
|
|
|
+ * 描述:
|
|
|
+ *
|
|
|
+ * @author huangwenwen
|
|
|
+ * @date 2025/2/11
|
|
|
+ */
|
|
|
+
|
|
|
+@RestControllerAdvice
|
|
|
+@Slf4j
|
|
|
+public class GlobalExceptionHandler {
|
|
|
+
|
|
|
+ @ExceptionHandler(BaseException.class)
|
|
|
+ public BaseResponse<Object> handleUserInfoException(BaseException e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return PageResponse.out(e.getCode(),e.getMessage(),null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ExceptionHandler(IllegalArgumentException.class)
|
|
|
+ public BaseResponse<Object> handleException(IllegalArgumentException e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return PageResponse.out(ResponseCode.LOGIC_ERROR.getCode(), e.getMessage(),null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ExceptionHandler(Throwable.class)
|
|
|
+ public BaseResponse<Object> handleException(Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return PageResponse.out(ResponseCode.ERROR.getCode(),e.getMessage(),null);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|