Skip to content

Commit 1c7e81f

Browse files
authored
Go: Improve error handling in CreateCustomMetric example (#6347)) (#6348)
Replace fmt.Println() with an actual error log in case of an error.
1 parent 9a06db3 commit 1c7e81f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

go/cloudwatch/CreateCustomMetric/CreateCustomMetric.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package main
77
import (
88
"flag"
99
"fmt"
10+
"log"
1011

1112
"github.com/aws/aws-sdk-go/aws/session"
1213
"github.com/aws/aws-sdk-go/service/cloudwatch"
@@ -85,7 +86,7 @@ func main() {
8586

8687
err := CreateCustomMetric(sess, namespace, metricName, unit, value, dimensionName, dimensionValue)
8788
if err != nil {
88-
fmt.Println()
89+
log.Fatalf("Could not create custom metric: %v", err)
8990
}
9091
}
9192

0 commit comments

Comments
 (0)