Skip to content

Commit 2add219

Browse files
authored
Improve errors in s3.go
1 parent aa38a69 commit 2add219

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

s3secrets-helper/s3/s3.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type Client struct {
2525
region string
2626
}
2727

28-
func getRegion(ctx context.Context) (string, error) {
28+
func getCurrentRegion(ctx context.Context) (string, error) {
2929
if region := os.Getenv("AWS_DEFAULT_REGION"); len(region) > 0 {
3030
return region, nil
3131
}
@@ -57,7 +57,7 @@ func New(log *log.Logger, bucket string, regionHint string) (*Client, error) {
5757
} else {
5858
// Otherwise, use the current region (or a guess) to dynamically find
5959
// where the bucket lives.
60-
region, err := getRegion(ctx)
60+
region, err := getCurrentRegion(ctx)
6161
if err != nil {
6262
// Ignore error and fallback to us-east-1 for bucket lookup
6363
region = "us-east-1"
@@ -77,7 +77,7 @@ func New(log *log.Logger, bucket string, regionHint string) (*Client, error) {
7777
log.Printf("Discovered bucket region as %q\n", bucketRegion)
7878
awsConfig.Region = bucketRegion
7979
} else {
80-
log.Printf("Could not discover bucket region for %q. Using the %q region as a fallback, configure a bucket region using the %q environment variable. (%v)\n", bucket, awsConfig.Region, env.EnvRegion, err)
80+
log.Printf("Could not discover region for bucket %q. Using the %q region as a fallback, if this is not correct configure a bucket region using the %q environment variable. (%v)\n", bucket, awsConfig.Region, env.EnvRegion, err)
8181
}
8282
}
8383

0 commit comments

Comments
 (0)