Compare commits

...

1 Commits

Author SHA1 Message Date
peze 6d4007344d compatible with old err 2025-03-12 14:48:05 +08:00
+2 -8
View File
@@ -41,15 +41,11 @@ type CastError struct {
Message *string Message *string
} }
func TeaSDKError(err error) *tea.SDKError { func TeaSDKError(err error) error {
if(err == nil) { if(err == nil) {
return nil return nil
} }
if oe, ok := err.(*tea.SDKError); ok {
return oe
}
if te, ok := err.(*SDKError); ok { if te, ok := err.(*SDKError); ok {
return tea.NewSDKError(map[string]interface{}{ return tea.NewSDKError(map[string]interface{}{
"code": StringValue(te.Code), "code": StringValue(te.Code),
@@ -76,9 +72,7 @@ func TeaSDKError(err error) *tea.SDKError {
}) })
} }
return tea.NewSDKError(map[string]interface{}{ return err
"message": err.Error(),
})
} }
// NewSDKError is used for shortly create SDKError object // NewSDKError is used for shortly create SDKError object