|
|
@@ -1,6 +1,7 @@
|
|
|
package com.sqx.common.exception;
|
|
|
|
|
|
import com.sqx.common.utils.Result;
|
|
|
+import icu.xuyijie.secureapi.exception.SecureApiException;
|
|
|
import org.apache.shiro.authz.AuthorizationException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
/**
|
|
|
* 异常处理器
|
|
|
*
|
|
|
@@ -63,6 +66,12 @@ public class SqxExceptionHandler {
|
|
|
return Result.error("请求参数缺失");
|
|
|
}
|
|
|
|
|
|
+ @ExceptionHandler(value = SecureApiException.class)
|
|
|
+ public Result secureApiException(HttpServletRequest request, SecureApiException e) {
|
|
|
+ logger.error("SecureApi异常:{}", e.getErrorMsg());
|
|
|
+ return Result.error(e.getErrorMsg());
|
|
|
+ }
|
|
|
+
|
|
|
@ExceptionHandler(Exception.class)
|
|
|
public Result handleException(Exception e){
|
|
|
logger.error(e.getMessage(), e);
|