⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/cmd/role/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ func CreateCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("branch %s does not exist in database %s (organization: %s)",
printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
return cmdutil.HandleNotFoundWithServiceTokenCheck(
cmd.Context(), cmd, ch.Config, ch.Client, err,
"create_branch_password or create_production_branch_password",
"database %s or branch %s does not exist in organization %s",
printer.BoldBlue(database), printer.BoldBlue(branch), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
}
Expand Down
5 changes: 4 additions & 1 deletion internal/cmd/role/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ func DeleteCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("role %s does not exist in branch %s of database %s (organization: %s)",
return cmdutil.HandleNotFoundWithServiceTokenCheck(
ctx, cmd, ch.Config, ch.Client, err,
"delete_branch_password or delete_production_branch_password",
"role %s does not exist in branch %s of database %s (organization: %s)",
printer.BoldBlue(roleID), printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
Expand Down
5 changes: 4 additions & 1 deletion internal/cmd/role/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ func GetCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("role %s does not exist in branch %s of database %s (organization: %s)",
return cmdutil.HandleNotFoundWithServiceTokenCheck(
ctx, cmd, ch.Config, ch.Client, err,
"read_branch",
"role %s does not exist in branch %s of database %s (organization: %s)",
printer.BoldBlue(roleID), printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
Expand Down
7 changes: 5 additions & 2 deletions internal/cmd/role/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ func ListCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("branch %s does not exist in database %s (organization: %s)",
printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
return cmdutil.HandleNotFoundWithServiceTokenCheck(
ctx, cmd, ch.Config, ch.Client, err,
"read_branch",
"database %s or branch %s does not exist in organization %s",
printer.BoldBlue(database), printer.BoldBlue(branch), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
}
Expand Down
5 changes: 4 additions & 1 deletion internal/cmd/role/reassign.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ func ReassignCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("role %s does not exist in branch %s of database %s (organization: %s)",
return cmdutil.HandleNotFoundWithServiceTokenCheck(
ctx, cmd, ch.Config, ch.Client, err,
"delete_branch_password or delete_production_branch_password",
"role %s does not exist in branch %s of database %s (organization: %s)",
printer.BoldBlue(roleID), printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
Expand Down
5 changes: 4 additions & 1 deletion internal/cmd/role/renew.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ func RenewCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("role %s does not exist in branch %s of database %s (organization: %s)",
return cmdutil.HandleNotFoundWithServiceTokenCheck(
ctx, cmd, ch.Config, ch.Client, err,
"create_branch_password or create_production_branch_password",
"role %s does not exist in branch %s of database %s (organization: %s)",
printer.BoldBlue(roleID), printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
Expand Down
5 changes: 4 additions & 1 deletion internal/cmd/role/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ func ResetCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("role %s does not exist in branch %s of database %s (organization: %s)",
return cmdutil.HandleNotFoundWithServiceTokenCheck(
ctx, cmd, ch.Config, ch.Client, err,
"delete_branch_password or delete_production_branch_password",
"role %s does not exist in branch %s of database %s (organization: %s)",
printer.BoldBlue(roleID), printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
Expand Down
7 changes: 5 additions & 2 deletions internal/cmd/role/reset_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ func ResetDefaultCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("branch %s does not exist in database %s (organization: %s)",
printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
return cmdutil.HandleNotFoundWithServiceTokenCheck(
cmd.Context(), cmd, ch.Config, ch.Client, err,
"delete_branch_password or delete_production_branch_password",
"database %s or branch %s does not exist in organization %s",
printer.BoldBlue(database), printer.BoldBlue(branch), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
}
Expand Down
5 changes: 4 additions & 1 deletion internal/cmd/role/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ func UpdateCmd(ch *cmdutil.Helper) *cobra.Command {
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
return fmt.Errorf("role %s does not exist in branch %s of database %s (organization: %s)",
return cmdutil.HandleNotFoundWithServiceTokenCheck(
ctx, cmd, ch.Config, ch.Client, err,
"create_branch_password or create_production_branch_password",
"role %s does not exist in branch %s of database %s (organization: %s)",
printer.BoldBlue(roleID), printer.BoldBlue(branch), printer.BoldBlue(database), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
Expand Down