redux-model icon indicating copy to clipboard operation
redux-model copied to clipboard

如何在http service做统一的错误日志处理

Open DroganC opened this issue 4 years ago • 5 comments

我看到http service的onError相关参数都是HttpResponse 只有在beforeSend里才有requestOptions 如果要记录log貌似只能在model里面进行

是否可以在onRespondError的时候也能带上request呢

DroganC avatar Dec 05 '20 06:12 DroganC

request一般是要拿到里面的什么信息呢?

fwh1990 avatar Dec 06 '20 13:12 fwh1990

如果要记录log貌似只能在model里面进行

这句话没看懂

fwh1990 avatar Dec 06 '20 13:12 fwh1990

request一般是要拿到里面的什么信息呢?

onRespondError的时候希望能返回当前请求的信息,包括url params等这些请求参数 。

DroganC avatar Dec 07 '20 02:12 DroganC

4d8ad66 这个commit能否满足要求

可以的 已经发布了吗

DroganC avatar Dec 07 '20 07:12 DroganC

发布9.0.3, https://github.com/redux-model/redux-model/commit/f5e00c413068c19c31cf80ec1a9c5624770ec801 ,行为方式向axios看齐

{
  onRespondError(httpResponse, meta) {
    console.log(httpResponse.config);
  }
}

fwh1990 avatar Dec 08 '20 05:12 fwh1990