From f724f47a0b128176b42f5432c5bbc2d55d7864b6 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Tue, 6 Apr 2021 11:57:35 +0300 Subject: [PATCH] cmd: improve "Error: Not Found" messages This PR improves all generic `Error: Not Found` messages with more detailed and useful messages. Also in every single message we also include the organization, to make sure the user didn't accidentaly executed the CLI command on a different organization. depends on: https://github.com/planetscale/cli/pull/147 closes: https://github.com/planetscale/project-big-bang/issues/163 --- internal/cmd/auth/login.go | 7 ++++++- internal/cmd/backup/create.go | 4 +++- internal/cmd/backup/delete.go | 3 ++- internal/cmd/backup/get.go | 3 ++- internal/cmd/backup/list.go | 3 ++- internal/cmd/branch/create.go | 3 ++- internal/cmd/branch/delete.go | 3 ++- internal/cmd/branch/get.go | 3 ++- internal/cmd/branch/list.go | 3 ++- internal/cmd/branch/status.go | 3 ++- internal/cmd/database/create.go | 2 +- internal/cmd/database/delete.go | 3 ++- internal/cmd/database/get.go | 3 ++- internal/cmd/database/list.go | 2 +- internal/cmd/deployrequest/close.go | 2 +- internal/cmd/deployrequest/create.go | 2 +- internal/cmd/deployrequest/deploy.go | 2 +- internal/cmd/deployrequest/diff.go | 2 +- internal/cmd/deployrequest/list.go | 2 +- internal/cmd/deployrequest/review.go | 2 +- internal/cmd/deployrequest/show.go | 2 +- internal/cmd/org/switch.go | 2 +- internal/cmd/shell/shell.go | 4 ++-- internal/cmd/snapshot/create.go | 4 ++-- internal/cmd/snapshot/get.go | 2 +- internal/cmd/snapshot/list.go | 4 ++-- internal/cmd/snapshot/request_deploy.go | 3 ++- internal/cmd/token/add-access.go | 2 +- internal/cmd/token/delete-access.go | 2 +- internal/cmd/token/delete.go | 3 ++- internal/cmd/token/get-access.go | 2 +- 31 files changed, 53 insertions(+), 34 deletions(-) diff --git a/internal/cmd/auth/login.go b/internal/cmd/auth/login.go index 1e05fb26..6d95539f 100644 --- a/internal/cmd/auth/login.go +++ b/internal/cmd/auth/login.go @@ -106,7 +106,12 @@ func writeDefaultOrganization(ctx context.Context, accessToken, authURL string) orgs, err := client.Organizations.List(ctx) if err != nil { - return err + switch cmdutil.ErrCode(err) { + case planetscale.ErrResponseMalformed: + return cmdutil.MalformedError(err) + default: + return errors.Wrap(err, "error listing organizations") + } } if len(orgs) > 0 { diff --git a/internal/cmd/backup/create.go b/internal/cmd/backup/create.go index d0d4aa4e..403f78eb 100644 --- a/internal/cmd/backup/create.go +++ b/internal/cmd/backup/create.go @@ -40,8 +40,10 @@ func CreateCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s", cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database)) + return fmt.Errorf("branch %s does not exist in database %s (organization: %s)", + cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: + return cmdutil.MalformedError(err) default: return err diff --git a/internal/cmd/backup/delete.go b/internal/cmd/backup/delete.go index 9fd4a477..78c7c4d6 100644 --- a/internal/cmd/backup/delete.go +++ b/internal/cmd/backup/delete.go @@ -74,7 +74,8 @@ func DeleteCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in branch %s of %s\n", cmdutil.BoldBlue(backup), cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database)) + return fmt.Errorf("backup %s does not exist in branch %s of %s (organization: %s)\n", + cmdutil.BoldBlue(backup), cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/backup/get.go b/internal/cmd/backup/get.go index 488c3e22..b39fcd8b 100644 --- a/internal/cmd/backup/get.go +++ b/internal/cmd/backup/get.go @@ -61,7 +61,8 @@ func GetCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in branch %s of %s\n", cmdutil.BoldBlue(backup), cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database)) + return fmt.Errorf("backup %s does not exist in branch %s of %s (organization: %s)\n", + cmdutil.BoldBlue(backup), cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/backup/list.go b/internal/cmd/backup/list.go index 8f3b56f3..7e66a340 100644 --- a/internal/cmd/backup/list.go +++ b/internal/cmd/backup/list.go @@ -55,7 +55,8 @@ func ListCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database)) + return fmt.Errorf("branch %s does not exist in database %s (organization: %s)\n", + cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/branch/create.go b/internal/cmd/branch/create.go index b77c5052..816cdbbc 100644 --- a/internal/cmd/branch/create.go +++ b/internal/cmd/branch/create.go @@ -66,7 +66,8 @@ func CreateCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", cmdutil.BoldBlue(source), cmdutil.BoldBlue(cfg.Organization)) + return fmt.Errorf("source database %s does not exist in organization %s\n", + cmdutil.BoldBlue(source), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/branch/delete.go b/internal/cmd/branch/delete.go index 86ddd512..7f8f9f20 100644 --- a/internal/cmd/branch/delete.go +++ b/internal/cmd/branch/delete.go @@ -72,7 +72,8 @@ func DeleteCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", cmdutil.BoldBlue(source), cmdutil.BoldBlue(cfg.Organization)) + return fmt.Errorf("source database %s does not exist in organization %s\n", + cmdutil.BoldBlue(source), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/branch/get.go b/internal/cmd/branch/get.go index 037914ae..ab636fae 100644 --- a/internal/cmd/branch/get.go +++ b/internal/cmd/branch/get.go @@ -53,7 +53,8 @@ func GetCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s", cmdutil.BoldBlue(branch), cmdutil.BoldBlue(source)) + return fmt.Errorf("branch %s does not exist in database %s (organization: %s)", + cmdutil.BoldBlue(branch), cmdutil.BoldBlue(source), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/branch/list.go b/internal/cmd/branch/list.go index 02206ab8..4c13e378 100644 --- a/internal/cmd/branch/list.go +++ b/internal/cmd/branch/list.go @@ -53,7 +53,8 @@ func ListCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) + return fmt.Errorf("database %s does not exist in organization %s\n", + cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/branch/status.go b/internal/cmd/branch/status.go index 4462c8a0..3c0368c1 100644 --- a/internal/cmd/branch/status.go +++ b/internal/cmd/branch/status.go @@ -39,7 +39,8 @@ func StatusCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s", cmdutil.BoldBlue(branch), cmdutil.BoldBlue(source)) + return fmt.Errorf("branch %s does not exist in database %s (organization: %s)", + cmdutil.BoldBlue(branch), cmdutil.BoldBlue(source), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/database/create.go b/internal/cmd/database/create.go index 92b82b48..2f2c445f 100644 --- a/internal/cmd/database/create.go +++ b/internal/cmd/database/create.go @@ -54,7 +54,7 @@ func CreateCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in\n", cmdutil.BoldBlue(cfg.Organization)) + return fmt.Errorf("organization %s does not exist\n", cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/database/delete.go b/internal/cmd/database/delete.go index 27fe9d79..db299da2 100644 --- a/internal/cmd/database/delete.go +++ b/internal/cmd/database/delete.go @@ -70,7 +70,8 @@ func DeleteCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", cmdutil.BoldBlue(name), cmdutil.BoldBlue(cfg.Organization)) + return fmt.Errorf("database %s does not exist in organization %s\n", + cmdutil.BoldBlue(name), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/database/get.go b/internal/cmd/database/get.go index db8b4ebc..fe9c1d26 100644 --- a/internal/cmd/database/get.go +++ b/internal/cmd/database/get.go @@ -51,7 +51,8 @@ func GetCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", cmdutil.BoldBlue(name), cmdutil.BoldBlue(cfg.Organization)) + return fmt.Errorf("database %s does not exist in organization %s\n", + cmdutil.BoldBlue(name), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/database/list.go b/internal/cmd/database/list.go index 2ced0736..8ffee83d 100644 --- a/internal/cmd/database/list.go +++ b/internal/cmd/database/list.go @@ -50,7 +50,7 @@ func ListCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist\n", cmdutil.BoldBlue(cfg.Organization)) + return fmt.Errorf("organization %s does not exist\n", cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/deployrequest/close.go b/internal/cmd/deployrequest/close.go index 48521e11..eb0113ce 100644 --- a/internal/cmd/deployrequest/close.go +++ b/internal/cmd/deployrequest/close.go @@ -41,7 +41,7 @@ func CloseCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s/%s does not exist in %s\n", + return fmt.Errorf("deploy request '%s/%s' does not exist in organization %s\n", cmdutil.BoldBlue(database), cmdutil.BoldBlue(number), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/deployrequest/create.go b/internal/cmd/deployrequest/create.go index 5a444085..55bf2dda 100644 --- a/internal/cmd/deployrequest/create.go +++ b/internal/cmd/deployrequest/create.go @@ -44,7 +44,7 @@ func CreateCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", + return fmt.Errorf("database %s does not exist in %s\n", cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/deployrequest/deploy.go b/internal/cmd/deployrequest/deploy.go index 662acec0..b2051292 100644 --- a/internal/cmd/deployrequest/deploy.go +++ b/internal/cmd/deployrequest/deploy.go @@ -42,7 +42,7 @@ func DeployCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s/%s does not exist in %s\n", + return fmt.Errorf("deploy request '%s/%s' does not exist in organization %s\n", cmdutil.BoldBlue(database), cmdutil.BoldBlue(number), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/deployrequest/diff.go b/internal/cmd/deployrequest/diff.go index d36b3e1e..32986bcd 100644 --- a/internal/cmd/deployrequest/diff.go +++ b/internal/cmd/deployrequest/diff.go @@ -55,7 +55,7 @@ func DiffCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s/%s does not exist in %s\n", + return fmt.Errorf("deploy rquest '%s/%s' does not exist in organization %s\n", cmdutil.BoldBlue(database), cmdutil.BoldBlue(number), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/deployrequest/list.go b/internal/cmd/deployrequest/list.go index 2f582a58..29374ee3 100644 --- a/internal/cmd/deployrequest/list.go +++ b/internal/cmd/deployrequest/list.go @@ -54,7 +54,7 @@ func ListCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", + return fmt.Errorf("database %s does not exist in organization %s\n", cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/deployrequest/review.go b/internal/cmd/deployrequest/review.go index be41f8a6..7c470380 100644 --- a/internal/cmd/deployrequest/review.go +++ b/internal/cmd/deployrequest/review.go @@ -59,7 +59,7 @@ func ReviewCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s/%s does not exist in %s\n", + return fmt.Errorf("deploy request '%s/%s' does not exist in organization %s\n", cmdutil.BoldBlue(database), cmdutil.BoldBlue(number), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/deployrequest/show.go b/internal/cmd/deployrequest/show.go index d3a24658..4fa7ed38 100644 --- a/internal/cmd/deployrequest/show.go +++ b/internal/cmd/deployrequest/show.go @@ -52,7 +52,7 @@ func ShowCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s/%s does not exist in %s\n", + return fmt.Errorf("deploy request '%s/%s' does not exist in organization %s\n", cmdutil.BoldBlue(database), cmdutil.BoldBlue(number), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/org/switch.go b/internal/cmd/org/switch.go index 4ee03940..91eecdcb 100644 --- a/internal/cmd/org/switch.go +++ b/internal/cmd/org/switch.go @@ -44,7 +44,7 @@ func SwitchCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist\n", cmdutil.BoldBlue(orgName)) + return fmt.Errorf("organization %s does not exist\n", cmdutil.BoldBlue(orgName)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/shell/shell.go b/internal/cmd/shell/shell.go index 023abf4d..8a7b37d3 100644 --- a/internal/cmd/shell/shell.go +++ b/internal/cmd/shell/shell.go @@ -117,8 +117,8 @@ second argument: if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s", - cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database)) + return fmt.Errorf("branch %s does not exist in database %s (organization: %s)", + cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/snapshot/create.go b/internal/cmd/snapshot/create.go index 7a1e00c5..47053772 100644 --- a/internal/cmd/snapshot/create.go +++ b/internal/cmd/snapshot/create.go @@ -37,8 +37,8 @@ func CreateCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s", - cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database)) + return fmt.Errorf("branch %s does not exist in database %s (organization: %s)", + cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/snapshot/get.go b/internal/cmd/snapshot/get.go index 334cc457..47b8ff04 100644 --- a/internal/cmd/snapshot/get.go +++ b/internal/cmd/snapshot/get.go @@ -36,7 +36,7 @@ func GetCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("snapshot id %q does not exist", cmdutil.BoldBlue(id)) + return fmt.Errorf("snapshot id %s does not exist (organization: %s)", cmdutil.BoldBlue(id), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/snapshot/list.go b/internal/cmd/snapshot/list.go index 8eb9da02..de40735b 100644 --- a/internal/cmd/snapshot/list.go +++ b/internal/cmd/snapshot/list.go @@ -39,8 +39,8 @@ func ListCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", - cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database)) + return fmt.Errorf("branch %s does not exist in database %s (organization: %s)", + cmdutil.BoldBlue(branch), cmdutil.BoldBlue(database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/snapshot/request_deploy.go b/internal/cmd/snapshot/request_deploy.go index 460b151a..2bbbd695 100644 --- a/internal/cmd/snapshot/request_deploy.go +++ b/internal/cmd/snapshot/request_deploy.go @@ -34,7 +34,8 @@ func RequestDeployCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("snapshot id %q does not exist", cmdutil.BoldBlue(id)) + return fmt.Errorf("snapshot id %s does not exist (organization: %s)", + cmdutil.BoldBlue(id), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/token/add-access.go b/internal/cmd/token/add-access.go index f9242b9b..a9977d78 100644 --- a/internal/cmd/token/add-access.go +++ b/internal/cmd/token/add-access.go @@ -50,7 +50,7 @@ For a complete list of the access permissions that can be granted to a token, se if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", + return fmt.Errorf("database %s does not exist in organization %s\n", cmdutil.BoldBlue(cfg.Database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/token/delete-access.go b/internal/cmd/token/delete-access.go index 1fa33ae2..c51a77f4 100644 --- a/internal/cmd/token/delete-access.go +++ b/internal/cmd/token/delete-access.go @@ -41,7 +41,7 @@ func DeleteAccessCmd(cfg *config.Config) *cobra.Command { if err := client.ServiceTokens.DeleteAccess(ctx, req); err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", + return fmt.Errorf("database %s or token does not exist in organization %s\n", cmdutil.BoldBlue(cfg.Database), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) diff --git a/internal/cmd/token/delete.go b/internal/cmd/token/delete.go index 362af527..d2b7f794 100644 --- a/internal/cmd/token/delete.go +++ b/internal/cmd/token/delete.go @@ -38,7 +38,8 @@ func DeleteCmd(cfg *config.Config) *cobra.Command { if err := client.ServiceTokens.Delete(ctx, req); err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("token does not exist in %s\n", cmdutil.BoldBlue(cfg.Organization)) + return fmt.Errorf("token does not exist in organization %s\n", + cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err) default: diff --git a/internal/cmd/token/get-access.go b/internal/cmd/token/get-access.go index 9f9652ab..a59073b3 100644 --- a/internal/cmd/token/get-access.go +++ b/internal/cmd/token/get-access.go @@ -40,7 +40,7 @@ func GetCmd(cfg *config.Config) *cobra.Command { if err != nil { switch cmdutil.ErrCode(err) { case planetscale.ErrNotFound: - return fmt.Errorf("%s does not exist in %s\n", + return fmt.Errorf("access %s does not exist in organization %s\n", cmdutil.BoldBlue(name), cmdutil.BoldBlue(cfg.Organization)) case planetscale.ErrResponseMalformed: return cmdutil.MalformedError(err)