feat:优化

This commit is contained in:
wangyu 2022-03-22 15:13:23 +08:00
parent 5f6d967bf4
commit ec17382474

View File

@ -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<Result<Void>> userInvalidExceptionHandler(UserInvalidException ex) {
logger.error(ex.getMessage(), ex);
return Mono.just(Result.error(ex.getMessage()));