+mtwmapi.ErrCodeSuccess
This commit is contained in:
@@ -41,6 +41,7 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
ErrCodeSuccess = 0
|
||||
ErrCodeSysErr = 700 // 系统错误,按美团外卖技术支持的说法,可当成需重试的错误
|
||||
ErrCodeParameterFormatWrong = 705 // 参数格式错误
|
||||
ErrCodeAccessLimited = 711 // 接口调用过于频繁,触发流控,请降低调用频率
|
||||
@@ -176,16 +177,18 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{
|
||||
retVal = jsonResult1
|
||||
}
|
||||
if errObj, ok := jsonResult1["error"]; ok {
|
||||
baseapi.SugarLogger.Debugf("mtwm AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||
errorInfo := errObj.(map[string]interface{})
|
||||
errCode := int(utils.MustInterface2Int64(errorInfo["code"]))
|
||||
newErr := utils.NewErrorIntCode(errorInfo["msg"].(string), errCode)
|
||||
if canRetryCodes[errCode] == 1 {
|
||||
return platformapi.ErrLevelExceedLimit, newErr
|
||||
} else if canRecoverCodes[errCode] == 1 {
|
||||
return platformapi.ErrLevelRecoverableErr, newErr
|
||||
} else if errCode != 0 {
|
||||
return platformapi.ErrLevelCodeIsNotOK, newErr
|
||||
if errCode != ErrCodeSuccess {
|
||||
baseapi.SugarLogger.Debugf("mtwm AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||
newErr := utils.NewErrorIntCode(errorInfo["msg"].(string), errCode)
|
||||
if canRetryCodes[errCode] == 1 {
|
||||
return platformapi.ErrLevelExceedLimit, newErr
|
||||
} else if canRecoverCodes[errCode] == 1 {
|
||||
return platformapi.ErrLevelRecoverableErr, newErr
|
||||
} else {
|
||||
return platformapi.ErrLevelCodeIsNotOK, newErr
|
||||
}
|
||||
}
|
||||
}
|
||||
return platformapi.ErrLevelSuccess, nil
|
||||
|
||||
Reference in New Issue
Block a user