|
|
@ -82,9 +82,9 @@ public class GlobalExceptionHandler {
|
|
|
|
* 拦截 业务异常
|
|
|
|
* 拦截 业务异常
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ExceptionHandler(ServiceException.class)
|
|
|
|
@ExceptionHandler(ServiceException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo<?> bussinessException(ServiceException e) {
|
|
|
|
public ResultVo<?> businessException(ServiceException e) {
|
|
|
|
log.warn("业务异常 - 异常编号:{} - 异常信息:{}",e.getCode(),e.getMessage());
|
|
|
|
log.warn("业务异常 - 异常编号:{} - 异常信息:{}",e.getCode(),e.getMessage());
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -93,7 +93,7 @@ public class GlobalExceptionHandler {
|
|
|
|
* 拦截 自定义 空异常
|
|
|
|
* 拦截 自定义 空异常
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ExceptionHandler(EmptyException.class)
|
|
|
|
@ExceptionHandler(EmptyException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo<?> emptyException(EmptyException e) {
|
|
|
|
public ResultVo<?> emptyException(EmptyException e) {
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
@ -103,7 +103,7 @@ public class GlobalExceptionHandler {
|
|
|
|
* 拦截 自定义 Jwt 认证异常
|
|
|
|
* 拦截 自定义 Jwt 认证异常
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ExceptionHandler(JwtException.class)
|
|
|
|
@ExceptionHandler(JwtException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo<?> jwtException(JwtException e) {
|
|
|
|
public ResultVo<?> jwtException(JwtException e) {
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
@ -124,7 +124,7 @@ public class GlobalExceptionHandler {
|
|
|
|
* 拦截 自定义 Shiro 认证异常
|
|
|
|
* 拦截 自定义 Shiro 认证异常
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ExceptionHandler(LockedAccountException.class)
|
|
|
|
@ExceptionHandler(LockedAccountException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo<?> lockedAccountException(LockedAccountException e) {
|
|
|
|
public ResultVo<?> lockedAccountException(LockedAccountException e) {
|
|
|
|
// 账号已被锁定,请联系管理员
|
|
|
|
// 账号已被锁定,请联系管理员
|
|
|
@ -135,7 +135,7 @@ public class GlobalExceptionHandler {
|
|
|
|
* 拦截 自定义 Shiro 认证异常
|
|
|
|
* 拦截 自定义 Shiro 认证异常
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ExceptionHandler(AuthorizationException.class)
|
|
|
|
@ExceptionHandler(AuthorizationException.class)
|
|
|
|
@ResponseStatus(HttpStatus.NOT_ACCEPTABLE)
|
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo<?> authorizationException(AuthorizationException e) {
|
|
|
|
public ResultVo<?> authorizationException(AuthorizationException e) {
|
|
|
|
// 无权访问该方法
|
|
|
|
// 无权访问该方法
|
|
|
@ -148,7 +148,7 @@ public class GlobalExceptionHandler {
|
|
|
|
* 拦截 自定义 Shiro 认证异常
|
|
|
|
* 拦截 自定义 Shiro 认证异常
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ExceptionHandler(UnsupportedTokenException.class)
|
|
|
|
@ExceptionHandler(UnsupportedTokenException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo<?> unsupportedTokenException(UnsupportedTokenException e) {
|
|
|
|
public ResultVo<?> unsupportedTokenException(UnsupportedTokenException e) {
|
|
|
|
// 找不到认证授权器
|
|
|
|
// 找不到认证授权器
|
|
|
@ -162,7 +162,7 @@ public class GlobalExceptionHandler {
|
|
|
|
* 拦截 自定义 Token 认证异常
|
|
|
|
* 拦截 自定义 Token 认证异常
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ExceptionHandler(TokenException.class)
|
|
|
|
@ExceptionHandler(TokenException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo<?> tokenException(TokenException e) {
|
|
|
|
public ResultVo<?> tokenException(TokenException e) {
|
|
|
|
// Token 异常
|
|
|
|
// Token 异常
|
|
|
|