Commit cb9d1c09 authored by Pan's avatar Pan

perf[request.js]: refine error reject

parent 7aef0391
...@@ -48,7 +48,7 @@ service.interceptors.response.use( ...@@ -48,7 +48,7 @@ service.interceptors.response.use(
// if the custom code is not 20000, it is judged as an error. // if the custom code is not 20000, it is judged as an error.
if (res.code !== 20000) { if (res.code !== 20000) {
Message({ Message({
message: res.message || 'error', message: res.message || 'Error',
type: 'error', type: 'error',
duration: 5 * 1000 duration: 5 * 1000
}) })
...@@ -66,7 +66,7 @@ service.interceptors.response.use( ...@@ -66,7 +66,7 @@ service.interceptors.response.use(
}) })
}) })
} }
return Promise.reject(res.message || 'error') return Promise.reject(new Error(res.message || 'Error'))
} else { } else {
return res return res
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment