From 2c38d20841aa95c7950817c3f461a56d972cfb2e Mon Sep 17 00:00:00 2001 From: winixt Date: Wed, 21 Jul 2021 19:05:27 +0800 Subject: [PATCH 1/2] fix: await request error --- packages/fes-plugin-request/src/template/request.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/fes-plugin-request/src/template/request.js b/packages/fes-plugin-request/src/template/request.js index 62eac21d..c2a819bf 100644 --- a/packages/fes-plugin-request/src/template/request.js +++ b/packages/fes-plugin-request/src/template/request.js @@ -163,7 +163,7 @@ function handleRequestError({ } if (!skipObj[errorKey] && errorHandler[errorKey]) { - errorHandler[errorKey](error); + return errorHandler[errorKey](error); } } @@ -179,11 +179,11 @@ export const request = (url, data, options = {}) => { const userConfig = userConfigHandler(url, data, options); const context = createContext(userConfig); - return currentRequestInstance.request(context).then(() => { + return currentRequestInstance.request(context).then(async () => { if (!context.error) { return context.config.useResonse ? context.response : context.response.data; } - handleRequestError(context); + await handleRequestError(context); return Promise.reject(context.error); }); }; From 9a5f2c57accefe62d814ee260ee8aa1c7be2dffb Mon Sep 17 00:00:00 2001 From: winixt Date: Wed, 21 Jul 2021 19:12:25 +0800 Subject: [PATCH 2/2] chore(release): publish - @fesjs/plugin-request@2.0.1 --- packages/fes-plugin-request/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fes-plugin-request/package.json b/packages/fes-plugin-request/package.json index cd8be17d..69d06690 100644 --- a/packages/fes-plugin-request/package.json +++ b/packages/fes-plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-request", - "version": "2.0.0", + "version": "2.0.1", "description": "@fesjs/plugin-request", "main": "lib/index.js", "files": [