Skip to content

Commit

Permalink
error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikhs committed Aug 29, 2024
1 parent 08d06b0 commit 257869b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmd/alter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,22 @@ var alterCmd = &cobra.Command{

tx := conn.BeginTransaction()

conn.AddRole(tx, username, add_roles)
conn.RemoveRole(tx, username, remove_roles)
err = conn.AddRole(tx, username, add_roles)
if err != nil {
cmd.Println(fmt.Errorf("could not add role: %v", err))
os.Exit(1)
}
err = conn.RemoveRole(tx, username, remove_roles)
if err != nil {
cmd.Println(fmt.Errorf("could not remove role: %v", err))
os.Exit(1)
}

tx.Commit()
err = tx.Commit()
if err != nil {
cmd.Println(fmt.Errorf("could not commit: %v", err))
os.Exit(1)
}

output := getOutputType(cmd)
if output == OutputTypeJson {
Expand Down

0 comments on commit 257869b

Please sign in to comment.