优化异常返回编号

v1.4.1
Parker 4 years ago
parent 5a4188673f
commit 9870bec03a

@ -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 异常

Loading…
Cancel
Save