全局异常处理

pull/13/MERGE
RuoYi 4 years ago
parent 15a4a5350d
commit 4ec6d51aca

@ -27,7 +27,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
@Override
public R<LoginUser> getUserInfo(String username)
{
return null;
return R.fail("获取用户失败:" + throwable.getMessage());
}
};
}

@ -55,6 +55,12 @@ public class SysLoginService
}
// 查询用户信息
R<LoginUser> userResult = remoteUserService.getUserInfo(username);
if (R.FAIL == userResult.getCode())
{
throw new BaseException(userResult.getMsg());
}
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
{
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");

@ -29,7 +29,7 @@ public class GlobalExceptionHandler
@ExceptionHandler(BaseException.class)
public AjaxResult baseException(BaseException e)
{
return AjaxResult.error(e.getMessage());
return AjaxResult.error(e.getDefaultMessage());
}
/**

Loading…
Cancel
Save