From ec173824743a3549598527e05dead15e59ab0565 Mon Sep 17 00:00:00 2001 From: wangyu <727842003@qq.com> Date: Tue, 22 Mar 2022 15:13:23 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/flyfish/framework/handler/GlobalExceptionHandler.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flyfish-web/src/main/java/com/flyfish/framework/handler/GlobalExceptionHandler.java b/flyfish-web/src/main/java/com/flyfish/framework/handler/GlobalExceptionHandler.java index f5c08b9..ff44ff3 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/handler/GlobalExceptionHandler.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/handler/GlobalExceptionHandler.java @@ -12,8 +12,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.dao.DuplicateKeyException; +import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.support.WebExchangeBindException; import reactor.core.publisher.Mono; @@ -43,6 +45,7 @@ public class GlobalExceptionHandler { } @ExceptionHandler(UserInvalidException.class) + @ResponseStatus(HttpStatus.UNAUTHORIZED) public Mono> userInvalidExceptionHandler(UserInvalidException ex) { logger.error(ex.getMessage(), ex); return Mono.just(Result.error(ex.getMessage()));