mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
refactor: 优化对外的 error 结构 (#109)
This commit is contained in:
parent
9058e93f16
commit
2a4f3bc333
@ -9,7 +9,11 @@ export default async (ctx, next) => {
|
||||
if (!config.closeResDataCheck && response && isObject(response.data)) {
|
||||
const code = response.data.code;
|
||||
if (code !== '0') {
|
||||
ctx.error = response; // code 不为零进入 reject
|
||||
// 尽量保持内部 error 结构和 http 异常的 error 结构一致
|
||||
ctx.error = {
|
||||
...response,
|
||||
response
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user