Handle errors for Commit and Rollback in campsite/types/option
This commit is contained in:
parent
7fc87b5cb5
commit
a174837aea
|
@ -208,9 +208,13 @@ func processOptionForm(w http.ResponseWriter, r *http.Request, user *auth.User,
|
|||
|
||||
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/"+f.TypeSlug+"/options", http.StatusSeeOther)
|
||||
|
|
Loading…
Reference in New Issue