From f95e899eb6b7386e8718af8ae4de8a7209330dd7 Mon Sep 17 00:00:00 2001 From: Jeremy Levy Date: Tue, 31 May 2022 12:16:38 +0200 Subject: [PATCH] Improve AWS error messages --- internal/aws/errors_presenter.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/aws/errors_presenter.go b/internal/aws/errors_presenter.go index 6387b6f..a53e8d6 100644 --- a/internal/aws/errors_presenter.go +++ b/internal/aws/errors_presenter.go @@ -41,11 +41,13 @@ func (v AWSViewableErrorBuilder) Build(err error) (viewableError *presenters.Vie viewableError.Title = "No AWS account found" viewableError.Message = fmt.Sprintf(`An AWS account can be configured: - - by setting the \"%s\" and \"%s\" environment variables. + - by setting the "%s", "%s" and "%s" environment variables. - - by installing the AWS CLI and running \"aws configure\".`, + - by installing the AWS CLI and running "aws configure".`, userconfig.AWSAccessKeyIDEnvVar, - userconfig.AWSSecretAccessKeyEnvVar) + userconfig.AWSSecretAccessKeyEnvVar, + userconfig.AWSRegionEnvVar, + ) return } @@ -73,7 +75,7 @@ func (v AWSViewableErrorBuilder) Build(err error) (viewableError *presenters.Vie if errors.Is(err, userconfig.ErrMissingRegionInEnv) { viewableError.Title = "Missing region" viewableError.Message = fmt.Sprintf( - "A region needs to be specified by setting the environment variable \"%s\" or by using the flag \"--region\".", + "A region needs to be specified by setting the \"%s\" environment variable or by using the \"--region\" flag.", userconfig.AWSRegionEnvVar, ) @@ -82,7 +84,7 @@ func (v AWSViewableErrorBuilder) Build(err error) (viewableError *presenters.Vie if errors.Is(err, userconfig.ErrMissingRegionInFiles) { viewableError.Title = "Missing region" - viewableError.Message = "A region needs to be specified by using the flag \"--region\"." + viewableError.Message = "A region needs to be specified by using the \"--region\" flag." return } @@ -144,7 +146,7 @@ func (v AWSViewableErrorBuilder) Build(err error) (viewableError *presenters.Vie viewableError.Title = "Unsupported instance type" viewableError.Message = fmt.Sprintf( "The instance type \"%s\" is not supported by Recode.\n\n"+ - "Only on-demand instances with EBS and architectures \"%s\" are supported.", + "Only on-demand linux instances with EBS and \"%s\" architectures are supported.", typedError.InstanceType, typedError.SupportedArchs, )