mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-10-15 03:32:11 +08:00
fix: 处理 default 异常问题?
This commit is contained in:
parent
bae7c46200
commit
65ff06cf4a
@ -168,8 +168,11 @@ function handleRequestError({
|
|||||||
const errorKey = getErrorKey(error, response);
|
const errorKey = getErrorKey(error, response);
|
||||||
|
|
||||||
if (!isSkipErrorHandler(config, errorKey)) {
|
if (!isSkipErrorHandler(config, errorKey)) {
|
||||||
const errorHandlerFn = errorHandler[errorKey || 'default'];
|
if (isFunction(errorHandler[errorKey])) {
|
||||||
errorHandlerFn && errorHandlerFn(error, response);
|
errorHandler[errorKey](error, response);
|
||||||
|
} else if (isFunction(errorHandler.default)) {
|
||||||
|
errorHandler.default(error, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ export default {
|
|||||||
|
|
||||||
const get = () => {
|
const get = () => {
|
||||||
request('/api', null, {
|
request('/api', null, {
|
||||||
skipErrorHandler: '123'
|
skipErrorHandler: ['500']
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log('skip error', err);
|
console.log('skip error', err);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user