|
|
@@ -0,0 +1,14 @@
|
|
|
+package com.zxyj.config;
|
|
|
+
|
|
|
+import com.zxyj.common.Result;
|
|
|
+import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
+import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
|
+
|
|
|
+@RestControllerAdvice
|
|
|
+public class GlobalExceptionHandler {
|
|
|
+
|
|
|
+ @ExceptionHandler(IllegalArgumentException.class)
|
|
|
+ public Result<Void> handleIllegalArgumentException(IllegalArgumentException e) {
|
|
|
+ return Result.error(400, e.getMessage());
|
|
|
+ }
|
|
|
+}
|