|
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
|
|
|
|
+import org.springframework.web.server.MissingRequestValueException;
|
|
|
import org.springframework.web.server.ServerWebExchange;
|
|
import org.springframework.web.server.ServerWebExchange;
|
|
|
import reactor.core.publisher.Mono;
|
|
import reactor.core.publisher.Mono;
|
|
|
|
|
|
|
@@ -50,7 +51,12 @@ public class GlobalExceptionHandler {
|
|
|
log.warn("接口异常 uri = {} e = {}", exchange.getRequest().getPath().value(), LogExceptionStackTrace.erroStackTrace(e));
|
|
log.warn("接口异常 uri = {} e = {}", exchange.getRequest().getPath().value(), LogExceptionStackTrace.erroStackTrace(e));
|
|
|
return RW.fail(HttpStatus.FORBIDDEN.toString(), "没有权限,请联系管理员授权", Mono.just(e.getMessage()));
|
|
return RW.fail(HttpStatus.FORBIDDEN.toString(), "没有权限,请联系管理员授权", Mono.just(e.getMessage()));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ //@ResponseStatus(HttpStatus.BAD_REQUEST)
|
|
|
|
|
+ @ExceptionHandler(MissingRequestValueException.class)
|
|
|
|
|
+ public Mono<RW<Object>> handleMissingRequestValueException(ServerWebExchange exchange, AccessDeniedException e) {
|
|
|
|
|
+ log.warn("接口异常 uri = {} e = {}", exchange.getRequest().getPath().value(), LogExceptionStackTrace.erroStackTrace(e));
|
|
|
|
|
+ return RW.fail(HttpStatus.FORBIDDEN.toString(), "请求参数异常", Mono.just(e.getMessage()));
|
|
|
|
|
+ }
|
|
|
@ExceptionHandler(AccountExpiredException.class)
|
|
@ExceptionHandler(AccountExpiredException.class)
|
|
|
public Mono<RW<Object>> handleAccountExpiredException(ServerWebExchange exchange, AccountExpiredException e) {
|
|
public Mono<RW<Object>> handleAccountExpiredException(ServerWebExchange exchange, AccountExpiredException e) {
|
|
|
log.warn("接口异常 uri = {} e = {}", exchange.getRequest().getPath().value(), LogExceptionStackTrace.erroStackTrace(e));
|
|
log.warn("接口异常 uri = {} e = {}", exchange.getRequest().getPath().value(), LogExceptionStackTrace.erroStackTrace(e));
|