请求方式 不支持 异常抛出处理
获取userId
This commit is contained in:
@@ -5,6 +5,7 @@ import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.context.request.ServletWebRequest;
|
||||
@@ -53,6 +54,13 @@ public class SqxExceptionHandler {
|
||||
return Result.error("没有权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public Result httpRequestMethodNotSupportedException(Exception e, WebRequest webRequest) {
|
||||
logErrorInfo(webRequest);
|
||||
logger.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Result handleException(Exception e, WebRequest webRequest) {
|
||||
logErrorInfo(webRequest);
|
||||
|
||||
Reference in New Issue
Block a user