Skip to content

Commit

Permalink
Improve AWS error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylevy committed May 31, 2022
1 parent ad478c5 commit f95e899
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions internal/aws/errors_presenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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,
)

Expand All @@ -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
}
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit f95e899

Please # to comment.