Ver Fonte

fix bug:modify error message when roleArn is wrong

归邪 há 7 anos atrás
pai
commit
557e64bedc

+ 3 - 0
ChangeLog.txt

@@ -1,3 +1,6 @@
+2018-03-09 Version:1.2.2
+1, fix bug:modify error message when roleArn is wrong
+
 2018-03-09 Version: 1.2.1
 1, complete api comments
 

+ 1 - 3
sdk/auth/signers/signer_ecs_ram_role.go

@@ -152,9 +152,7 @@ func (signer *EcsRamRoleSigner) refreshCredential(response *responses.CommonResp
 		return
 	}
 	if accessKeyId == nil || accessKeySecret == nil || securityToken == nil {
-		if signer.sessionCredential == nil {
-			panic("refresh Ecs sts token failed, accessKeyId, accessKeySecret or securityToken is null")
-		}
+		return
 	}
 
 	expirationTime, err := time.Parse("2006-01-02T15:04:05Z", expiration.(string))

+ 1 - 6
sdk/auth/signers/signer_key_pair.go

@@ -120,9 +120,6 @@ func (signer *SignerKeyPair) refreshCredential(response *responses.CommonRespons
 	if response.GetHttpStatus() != http.StatusOK {
 		message := "refresh session AccessKey failed"
 		err = errors.NewServerError(response.GetHttpStatus(), response.GetHttpContentString(), message)
-		if signer.sessionCredential == nil {
-			panic(err)
-		}
 		return
 	}
 	var data interface{}
@@ -142,9 +139,7 @@ func (signer *SignerKeyPair) refreshCredential(response *responses.CommonRespons
 		return
 	}
 	if accessKeyId == nil || accessKeySecret == nil {
-		if signer.sessionCredential == nil {
-			panic("refresh KeyPair, accessKeyId or accessKeySecret is null")
-		}
+		return
 	}
 	signer.sessionCredential = &SessionAkCredential{
 		accessKeyId:     accessKeyId.(string),

+ 1 - 6
sdk/auth/signers/signer_ram_role_arn.go

@@ -137,9 +137,6 @@ func (signer *RamRoleArnSigner) refreshCredential(response *responses.CommonResp
 	if response.GetHttpStatus() != http.StatusOK {
 		message := "refresh session token failed"
 		err = errors.NewServerError(response.GetHttpStatus(), response.GetHttpContentString(), message)
-		if signer.sessionCredential == nil {
-			panic(err)
-		}
 		return
 	}
 	var data interface{}
@@ -164,9 +161,7 @@ func (signer *RamRoleArnSigner) refreshCredential(response *responses.CommonResp
 		return
 	}
 	if accessKeyId == nil || accessKeySecret == nil || securityToken == nil {
-		if signer.sessionCredential == nil {
-			panic("refresh session token failed, accessKeyId, accessKeySecret or securityToken is null")
-		}
+		return
 	}
 	signer.sessionCredential = &sessionCredential{
 		accessKeyId:     accessKeyId.(string),