Skip to content

Commit

Permalink
test: formatError
Browse files Browse the repository at this point in the history
  • Loading branch information
yelexin committed Oct 18, 2019
1 parent d12f19e commit cc52fc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/utils/formatError.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ export function formatError(error) {
if (typeof error === 'string') return error;
if (error.request) {
// axios 错误
return JSON.stringify(error.response.data);
if(error.response)
return JSON.stringify(error.response.data);
else
return JSON.stringify(error.request);
} else if (typeof error.message === 'object') {
// graphql 错误
if (error.message.message) {
Expand Down
2 changes: 1 addition & 1 deletion tests/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ test('user:sendVerifyEmail 发送验证邮件', async t => {
t.assert(res.status === true);
});

test.only('user:checkLoginStatus 检查登录状态', async t => {
test('user:checkLoginStatus 检查登录状态', async t => {
const validAuth = auth;
let email = randomEmail();
let user = await validAuth.register({
Expand Down

0 comments on commit cc52fc2

Please sign in to comment.