下記のコードブロックの「if awsError, ok := err.(awserr.Error); ok {」の部分ですが、
どれが、trueだったらこのif文を通るか分かりません。
一番右の ok は返り値でしょうか??
「ok : err.(awserr.Error)」は「err.(awserr.Error)」の返り値を代入していると思うのですが、合っていますか??
一番左のawsErrorはどのタイミングの値なのでしょうか??
if awsError, ok := err.(awserr.Error); ok { switch awsError.Code() { case dynamodb.ErrCodeInternalServerError: fmt.Println(dynamodb.ErrCodeInternalServerError, awsError.Error()) default: fmt.Println(awsError.Error()) } } else { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/05/14 10:34