Check errors for Commit and Rollback in package campsite/types
This commit is contained in:
parent
8f5d5cf580
commit
0ebbf9613d
|
@ -244,9 +244,13 @@ func processTypeForm(w http.ResponseWriter, r *http.Request, user *auth.User, co
|
|||
|
||||
tx := conn.MustBegin(r.Context())
|
||||
if err := act(r.Context(), tx); err == nil {
|
||||
tx.Commit(r.Context())
|
||||
if err := tx.Commit(r.Context()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
tx.Rollback(r.Context())
|
||||
if err := tx.Rollback(r.Context()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
httplib.Redirect(w, r, "/admin/campsites/types", http.StatusSeeOther)
|
||||
|
|
Loading…
Reference in New Issue