This commit is contained in:
Mrx
2026-03-21 19:01:26 +08:00
parent a96c153286
commit 895b38ab88
3 changed files with 66 additions and 68 deletions

View File

@@ -97,14 +97,13 @@ func (a *AlicloudService) CallAPI(path string, params map[string]interface{}) (r
isTimeout := false
if netErr, ok := err.(interface{ Timeout() bool }); ok && netErr.Timeout() {
isTimeout = true
} else if errStr := err.Error();
errStr == "context deadline exceeded" ||
errStr == "timeout" ||
errStr == "Client.Timeout exceeded" ||
errStr == "net/http: request canceled" {
} else if errStr := err.Error(); errStr == "context deadline exceeded" ||
errStr == "timeout" ||
errStr == "Client.Timeout exceeded" ||
errStr == "net/http: request canceled" {
isTimeout = true
}
if isTimeout {
if a.logger != nil {
a.logger.LogError(requestID, transactionID, path, errors.Join(ErrDatasource, fmt.Errorf("API请求超时: %s", err.Error())), params)
@@ -140,4 +139,4 @@ func (a *AlicloudService) CallAPI(path string, params map[string]interface{}) (r
// GetConfig 获取配置信息
func (a *AlicloudService) GetConfig() AlicloudConfig {
return a.config
}
}