Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle transaction panic #335

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ changelog:
exclude:
- '^docs:'
- '^test:'

brew:
github:
owner: gobuffalo
name: homebrew-tap
6 changes: 6 additions & 0 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ func (c *Connection) Transaction(fn func(tx *Connection) error) error {
if err != nil {
return err
}
defer func() {
if err := recover(); err != nil {
cn.TX.Rollback()
err = errors.Errorf("panic err %v", err)
}
}()
err = fn(cn)
if err != nil {
dberr = cn.TX.Rollback()
Expand Down
2 changes: 1 addition & 1 deletion soda/cmd/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmd

// Version defines the current Pop version.
const Version = "v4.9.4-rc.2"
const Version = "v4.9.4"