|
|
@ -31,11 +31,9 @@ public class GlobalExceptionHandler {
|
|
|
|
@ExceptionHandler(ServiceException.class)
|
|
|
|
@ExceptionHandler(ServiceException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo bussinessException(ServiceException e) {
|
|
|
|
public ResultVo<?> bussinessException(ServiceException e) {
|
|
|
|
log.warn("业务异常 - 异常编号:{} - 异常信息:{}",e.getCode(),e.getMessage());
|
|
|
|
log.warn("业务异常 - 异常编号:{} - 异常信息:{}",e.getCode(),e.getMessage());
|
|
|
|
ResultVo errorR = ResultVo.error(e.getMessage());
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
|
errorR.setCode(e.getCode());
|
|
|
|
|
|
|
|
return errorR;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -44,10 +42,8 @@ public class GlobalExceptionHandler {
|
|
|
|
@ExceptionHandler(EmptyException.class)
|
|
|
|
@ExceptionHandler(EmptyException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo emptyException(EmptyException e) {
|
|
|
|
public ResultVo<?> emptyException(EmptyException e) {
|
|
|
|
ResultVo errorR = ResultVo.error(e.getMessage());
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
|
errorR.setCode(e.getCode());
|
|
|
|
|
|
|
|
return errorR;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -56,10 +52,8 @@ public class GlobalExceptionHandler {
|
|
|
|
@ExceptionHandler(NullPointerException.class)
|
|
|
|
@ExceptionHandler(NullPointerException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo nullPointerException(EmptyException e) {
|
|
|
|
public ResultVo<?> nullPointerException(EmptyException e) {
|
|
|
|
ResultVo errorR = ResultVo.error(e.getMessage());
|
|
|
|
return ResultVo.error(e.getCode(), e.getMessage());
|
|
|
|
errorR.setCode(e.getCode());
|
|
|
|
|
|
|
|
return errorR;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -68,11 +62,9 @@ public class GlobalExceptionHandler {
|
|
|
|
@ExceptionHandler(SQLIntegrityConstraintViolationException.class)
|
|
|
|
@ExceptionHandler(SQLIntegrityConstraintViolationException.class)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public ResultVo sqlIntegrityConstraintViolationException(EmptyException e) {
|
|
|
|
public ResultVo<?> sqlIntegrityConstraintViolationException(EmptyException e) {
|
|
|
|
log.error("数据异常:{}",e.getMessage(),e);
|
|
|
|
log.error("数据异常:{}",e.getMessage(),e);
|
|
|
|
ResultVo errorR = ResultVo.error(CoreMsg.SQL_EXCEPTION_INTEGRITY_CONSTRAINT_VIOLATION.getMessage());
|
|
|
|
return ResultVo.error(e.getCode(), CoreMsg.SQL_EXCEPTION_INTEGRITY_CONSTRAINT_VIOLATION.getMessage());
|
|
|
|
errorR.setCode(e.getCode());
|
|
|
|
|
|
|
|
return errorR;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|