mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-18 17:16:56 +08:00
异常返回
This commit is contained in:
parent
aa6bb1d845
commit
cf10eb779b
@ -1,5 +1,6 @@
|
|||||||
package xyz.playedu.api.controller;
|
package xyz.playedu.api.controller;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||||
import org.springframework.validation.ObjectError;
|
import org.springframework.validation.ObjectError;
|
||||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
@ -15,12 +16,14 @@ import xyz.playedu.api.types.JsonResponse;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
|
@Slf4j
|
||||||
public class ExceptionController {
|
public class ExceptionController {
|
||||||
|
|
||||||
// @ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
// public JsonResponse exceptionHandler(Exception e) {
|
public JsonResponse exceptionHandler(Exception e) {
|
||||||
// return JsonResponse.error("系统错误", 500);
|
log.error(e.getMessage());
|
||||||
// }
|
return JsonResponse.error("系统错误", 500);
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionHandler(ServiceException.class)
|
@ExceptionHandler(ServiceException.class)
|
||||||
public JsonResponse serviceExceptionHandler(ServiceException e) {
|
public JsonResponse serviceExceptionHandler(ServiceException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user