Skip to content

Commit

Permalink
fix: 兼容 2.x skipErrorHandler 参数
Browse files Browse the repository at this point in the history
  • Loading branch information
winixt committed Dec 13, 2023
1 parent 172d797 commit fc449c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/fes-plugin-request/src/template/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit fc449c4

Please sign in to comment.