- 美团外卖的ErrCodeSysErr当成可恢复错误(而不是超访问频率错误)
This commit is contained in:
@@ -67,9 +67,11 @@ type API struct {
|
||||
|
||||
var (
|
||||
canRetryCodes = map[int]int{
|
||||
ErrCodeSysErr: 1,
|
||||
ErrCodeAccessLimited: 1,
|
||||
}
|
||||
canRecoverCodes = map[int]int{
|
||||
ErrCodeSysErr: 1,
|
||||
}
|
||||
)
|
||||
|
||||
func New(appID, secret, callbackURL string, config ...*platformapi.APIConfig) *API {
|
||||
@@ -174,6 +176,8 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{
|
||||
newErr := utils.NewErrorIntCode(errorInfo["msg"].(string), int(utils.MustInterface2Int64(errorInfo["code"])))
|
||||
if canRetryCodes[newErr.IntCode()] == 1 {
|
||||
return platformapi.ErrLevelExceedLimit, newErr
|
||||
} else if canRecoverCodes[newErr.IntCode()] == 1 {
|
||||
return platformapi.ErrLevelRecoverableErr, newErr
|
||||
}
|
||||
return platformapi.ErrLevelCodeIsNotOK, newErr
|
||||
}
|
||||
|
||||
@@ -91,3 +91,10 @@ func TestPoiShipTimeUpdate(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPoiOpen(t *testing.T) {
|
||||
err := api.PoiOpen("6735933")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user