From 686b1d37fde3fd2cb2af6ec61835d534d2568361 Mon Sep 17 00:00:00 2001 From: Serge Date: Mon, 27 May 2019 16:24:47 +0800 Subject: [PATCH] perf[request.js]: refine error reject (#2160) --- src/utils/request.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index bc346a8c..71d5ea4b 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -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 }