Skip to content

Commit

Permalink
Describe errors
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasdinov committed Nov 3, 2022
1 parent 19f8a16 commit 08066d7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/content-rw-elasticsearch/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"github.com/aws/aws-sdk-go/aws/awserr"
"net/http"
"os"
"time"
Expand Down Expand Up @@ -148,6 +149,13 @@ func main() {
ClusterArn: &arn,
})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
log.WithField("code", awsErr.Code()).
WithField("message", awsErr.Message()).
WithField("full", awsErr.Error()).
WithField("original", awsErr.OrigErr()).
Error("Errrrr v2")
}
log.WithError(err).Error("Failed to describe v2 Kafka cluster")
} else {
log.WithField("state", output.ClusterInfo.State).Info("Cluster successfully described v2")
Expand All @@ -157,6 +165,13 @@ func main() {
ClusterArn: &arn,
})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
log.WithField("code", awsErr.Code()).
WithField("message", awsErr.Message()).
WithField("full", awsErr.Error()).
WithField("original", awsErr.OrigErr()).
Error("Errrrr v1")
}
log.WithError(err).Error("Failed to describe v1 Kafka cluster")
} else {
log.WithField("state", outputv1.ClusterInfo.State).Info("Cluster successfully described v1")
Expand Down

0 comments on commit 08066d7

Please sign in to comment.