Skip to content

Commit 1fbc71e

Browse files
authored
Merge pull request #1050 from ioito/hotfix/qx-huawei-errcode
fix(huawei): error code
2 parents 54fc3cc + 9cd9af9 commit 1fbc71e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

pkg/multicloud/huawei/huawei.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ func (self *SHuaweiClient) QueryAccountBalance() (*SBalance, error) {
514514
resp, err := self.list(service, "", "accounts/customer-accounts/balances", nil)
515515
if err != nil {
516516
// 国际区账号会报错: {"error_code":"CBC.0150","error_msg":"Access denied. The customer does not belong to the website you are now at."}
517-
if e, ok := err.(*httputils.JSONClientError); ok && e.Class == "CBC.0150" {
517+
if e, ok := err.(*sHuaweiError); ok && (e.ErrorCode == "CBC.0150" || e.ErrorCode == "CBC.0156") {
518518
continue
519519
}
520520
return nil, err

pkg/multicloud/huawei/saml_provider.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121

2222
"yunion.io/x/jsonutils"
2323
"yunion.io/x/pkg/errors"
24-
"yunion.io/x/pkg/util/httputils"
2524
"yunion.io/x/pkg/util/samlutils"
2625
"yunion.io/x/pkg/util/stringutils"
2726

@@ -209,11 +208,11 @@ func (self *SHuaweiClient) CreateSAMLProvider(opts *cloudprovider.SAMLProviderCr
209208
if err == nil {
210209
return nil
211210
}
212-
he, ok := errors.Cause(err).(*httputils.JSONClientError)
211+
he, ok := errors.Cause(err).(*sHuaweiError)
213212
if !ok {
214213
return errors.Wrapf(err, "SAMLProviders.Update")
215214
}
216-
if he.Code != 409 {
215+
if he.ErrorInfo.Code != "409" {
217216
return errors.Wrapf(err, "SAMLProviders.Update")
218217
}
219218
samlName = fmt.Sprintf("%s-%d", string(name), idx)

0 commit comments

Comments
 (0)