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()));