🚀 添加对网络请求错误的处理

This commit is contained in:
eatmoreapple 2021-09-14 22:02:21 +08:00
parent 2c48ced107
commit 6bf6b5b4d2

View File

@ -251,3 +251,13 @@ func IsNetworkError(err error) bool {
_, ok := err.(NetworkErr)
return ok
}
// IgnoreNetworkError 忽略网络请求的错误
func IgnoreNetworkError(errHandler func(err error)) func(error) {
return func(err error) {
if IsNetworkError(err) {
return
}
errHandler(err)
}
}