File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/pkg/cli/client/byoc/aws Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,18 @@ func (e ErrMissingAwsCreds) Unwrap() error {
7474 return e .err
7575}
7676
77+ type ErrMissingAwsRegion struct {
78+ err error
79+ }
80+
81+ func (e ErrMissingAwsRegion ) Error () string {
82+ return "missing AWS region: set AWS_REGION or edit your AWS profile (https://docs.defang.io/docs/providers/aws#region)"
83+ }
84+
85+ func (e ErrMissingAwsRegion ) Unwrap () error {
86+ return e .err
87+ }
88+
7789func AnnotateAwsError (err error ) error {
7890 if err == nil {
7991 return nil
@@ -82,6 +94,9 @@ func AnnotateAwsError(err error) error {
8294 if strings .Contains (err .Error (), "get credentials:" ) {
8395 return connect .NewError (connect .CodeUnauthenticated , ErrMissingAwsCreds {err })
8496 }
97+ if strings .Contains (err .Error (), "missing AWS region:" ) {
98+ return connect .NewError (connect .CodeUnauthenticated , ErrMissingAwsRegion {err })
99+ }
85100 if cerr := new (aws.ErrNoSuchKey ); errors .As (err , & cerr ) {
86101 return connect .NewError (connect .CodeNotFound , err )
87102 }
You can’t perform that action at this time.
0 commit comments