mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix aliyun error code handling changes, use error message string to
check message type
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
package aliyun
|
||||
|
||||
import (
|
||||
aliyunerrors "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func isError(err error, code string) bool {
|
||||
aliyunErr, ok := err.(aliyunerrors.Error)
|
||||
if !ok {
|
||||
errStr := fmt.Sprintf("%s", err)
|
||||
if strings.Index(errStr, code) > 0 {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
return aliyunErr.ErrorCode() == code
|
||||
}
|
||||
|
||||
@@ -702,6 +702,7 @@ func (self *SInstance) DeleteVM(ctx context.Context) error {
|
||||
log.Infof("The instance is initializing, try later ...")
|
||||
time.Sleep(10 * time.Second)
|
||||
} else {
|
||||
log.Errorf("DeleteVM fail: %s", err)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user