异常非空判断
This commit is contained in:
@@ -58,9 +58,10 @@ public class GlobalBusinessExceptionHandler {
|
||||
logService.recodeBusinessExceptionLog(businessException, httpServletRequest, businessException.getMessage());
|
||||
//判断方法上是否有自定义注解,做特殊处理
|
||||
Method method = ReflectCommonUtil.getMethod(businessException);
|
||||
if(method.isAnnotationPresent(ReturnMsg.class)){
|
||||
log.info("存在自定义注解");
|
||||
return HttpResultUtil.assembleResult(businessException.getCode(), null, StrFormatter.format("{}",businessException.getMessage()));
|
||||
if (!Objects.isNull(method)){
|
||||
if(method.isAnnotationPresent(ReturnMsg.class)){
|
||||
return HttpResultUtil.assembleResult(businessException.getCode(), null, StrFormatter.format("{}",businessException.getMessage()));
|
||||
}
|
||||
}
|
||||
return HttpResultUtil.assembleBusinessExceptionResult(businessException, null, operate);
|
||||
}
|
||||
@@ -232,7 +233,6 @@ public class GlobalBusinessExceptionHandler {
|
||||
//判断方法上是否有自定义注解,做特殊处理
|
||||
Method method = ReflectCommonUtil.getMethod(exception);
|
||||
if(method.isAnnotationPresent(ReturnMsg.class)){
|
||||
log.info("存在自定义注解");
|
||||
return HttpResultUtil.assembleResult(code, null, StrFormatter.format("{}",exceptionCause));
|
||||
}
|
||||
return HttpResultUtil.assembleResult(code, null, StrFormatter.format("{}{}{}", ReflectCommonUtil.getMethodDescribeByException(tempException), StrUtil.C_COMMA, exceptionCause));
|
||||
|
||||
@@ -108,9 +108,6 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
||||
addSendMessage(phone,vcode,msgTemplate,sendSmsResponse);
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
if (Objects.isNull(sendSmsResponse)){
|
||||
throw new BusinessException(UserResponseEnum.MESSAGE_SEND_FAIL);
|
||||
}
|
||||
return sendSmsResponse.getCode();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user