| | |
| | | import com.gkhy.assess.common.exception.ApiException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.authz.UnauthorizedException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 拦截未知的运行时异常 |
| | | */ |
| | | @ExceptionHandler(UnauthorizedException.class) |
| | | public CommonResult handleUnauthorizedException(RuntimeException ex, HttpServletRequest request) |
| | | { |
| | | writeExceptionLogFile(ex); |
| | | return CommonResult.failed("权限不足,无权操作!"); |
| | | } |
| | | |
| | | /** |
| | | * 拦截未知的运行时异常 |
| | | */ |
| | | @ExceptionHandler(RuntimeException.class) |
| | | public CommonResult handleRuntimeException(RuntimeException ex, HttpServletRequest request) |
| | | { |
| | |
| | | if (request!=null) { |
| | | url=request.getRequestURI(); |
| | | } |
| | | log.error("error={}",ex); |
| | | log.error("error:",ex); |
| | | log.error(ex.getMessage()+",url={}",url); |
| | | } |
| | | } |