perf[request.js]: refine error reject

This commit is contained in:
Pan 2019-05-27 17:01:46 +08:00
parent 7aef039149
commit cb9d1c0989
1 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ service.interceptors.response.use(
// if the custom code is not 20000, it is judged as an error.
if (res.code !== 20000) {
Message({
message: res.message || 'error',
message: res.message || 'Error',
type: 'error',
duration: 5 * 1000
})
@ -66,7 +66,7 @@ service.interceptors.response.use(
})
})
}
return Promise.reject(res.message || 'error')
return Promise.reject(new Error(res.message || 'Error'))
} else {
return res
}