diff --git a/aws-env.go b/aws-env.go index 8f46356..0a24f89 100644 --- a/aws-env.go +++ b/aws-env.go @@ -3,6 +3,7 @@ package main import ( "fmt" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ssm" "log" @@ -39,7 +40,12 @@ func ExportVariables(path string, nextToken string) { output, err := client.GetParametersByPath(input) if err != nil { - log.Panic(err) + if aerr, ok := err.(awserr.Error); ok { + log.Println(aerr.Error()) + } else { + log.Println(err.Error()) + } + os.Exit(1) } for _, element := range output.Parameters {