fix(region): validate jdcloud rds err

This commit is contained in:
Qu Xuan
2021-07-07 18:09:54 +08:00
parent ca21e3d122
commit 875abe66d6
+4 -1
View File
@@ -17,6 +17,7 @@ package jdcloud
import (
"fmt"
"strconv"
"strings"
"time"
commodels "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models"
@@ -200,8 +201,10 @@ func (self *SRegion) GetDBInstance(id string) (*SDBInstance, error) {
if err != nil {
return nil, errors.Wrapf(err, "DescribeInstanceAttributes")
}
if resp.Error.Code == 404 {
if resp.Error.Code == 404 || strings.Contains(resp.Error.Status, "NotFound") {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, jsonutils.Marshal(resp.Error).String())
} else if resp.Error.Code != 0 {
return nil, errors.Error(jsonutils.Marshal(resp.Error).String())
}
ret := SDBInstance{
region: self,