From fc449c42f8f2a540e89333b710e173522fda452d Mon Sep 17 00:00:00 2001 From: winixt Date: Wed, 13 Dec 2023 19:50:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=BC=E5=AE=B9=202.x=20skipErrorHand?= =?UTF-8?q?ler=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-request/src/template/request.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/fes-plugin-request/src/template/request.js b/packages/fes-plugin-request/src/template/request.js index a0a691932..e231af380 100644 --- a/packages/fes-plugin-request/src/template/request.js +++ b/packages/fes-plugin-request/src/template/request.js @@ -120,6 +120,12 @@ export const request = (url, data, options = {}) => { const { dataHandler, errorHandler } = getCustomerHandler(context, options); return currentRequestInstance.request(context).then(async () => { + if (context.config.skipErrorHandler) { + console.warn('3.x 已移除 skipErrorHandler 参数,请改用 dataHandler 处理'); + if (context.config.skipErrorHandler === true || context.response?.data?.code === context.config.skipErrorHandler) { + return Promise.reject(context.response); + } + } if (!context.error) { return dataHandler(context.response.data, context.response); }