fix aliyun error code handling changes, use error message string to

check message type
This commit is contained in:
Qiu Jian
2018-11-26 02:58:51 +08:00
parent 3b2b4d59e0
commit c398301eba
2 changed files with 7 additions and 4 deletions
+6 -4
View File
@@ -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
}
+1
View File
@@ -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 {