- 禁止TryUnmarshalUseNumber出错后报警

This commit is contained in:
gazebo
2019-03-28 22:57:47 +08:00
parent 005ffe003d
commit 615049f4b2

View File

@@ -130,7 +130,7 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
if bodyData, err := ioutil.ReadAll(response.Body); err == nil {
baseapi.SugarLogger.Errorf("AccessPlatformAPIWithRetry:%s HTTP code is:%d, url:%v, request:%v, response:%s", trackID, response.StatusCode, request.URL, getClonedData(request.URL, savedBuf), string(bodyData))
} else {
baseapi.SugarLogger.Errorf("AccessPlatformAPIWithRetry:%s HTTP code is:%d, url:%v, request:%v", trackID, response.StatusCode, request.URL, getClonedData(request.URL, savedBuf))
baseapi.SugarLogger.Errorf("AccessPlatformAPIWithRetry:%s HTTP code is:%d, url:%v, request:%v, ioutil.ReadAll failed with error:%v", trackID, response.StatusCode, request.URL, getClonedData(request.URL, savedBuf), err)
}
return ErrHTTPCodeIsNot200
}
@@ -142,7 +142,13 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
if err != nil {
baseapi.SugarLogger.Errorf("AccessPlatformAPIWithRetry:%s url:%v, request:%v failed with error:%v", trackID, request.URL, getClonedData(request.URL, savedBuf), err)
} else if err = utils.TryUnmarshalUseNumber(bodyData, &bodyMap); err != nil {
baseapi.SugarLogger.Errorf("AccessPlatformAPIWithRetry:%s url:%v, request:%v failed with error:%v, bodyData:%s", trackID, request.URL, getClonedData(request.URL, savedBuf), err, string(bodyData))
const maxOutputLen = 200
bodyDataLen := len(bodyData)
bodyData2 := bodyData
if bodyDataLen > maxOutputLen {
bodyData2 = bodyData2[:maxOutputLen]
}
baseapi.SugarLogger.Infof("AccessPlatformAPIWithRetry:%s url:%v, request:%v failed with error:%v, bodyData:%s", trackID, request.URL, getClonedData(request.URL, savedBuf), err, string(bodyData2))
}
if err != nil {