diff options
-rw-r--r-- | model/db.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/model/db.go b/model/db.go index f3fb607..3746f71 100644 --- a/model/db.go +++ b/model/db.go @@ -28,8 +28,7 @@ func OpenDB(path string) (*DB, error) { func (db *DB) Transaction(f func(*sql.Tx) error) error { tx, err := (*sql.DB)(db).Begin() if err != nil { - log.Printf("Failed to start database transaction: %v", err) - return err + return fmt.Errorf("Failed to start database transaction: %w", err) } defer func() { if tx.Rollback() == nil { @@ -39,8 +38,7 @@ func (db *DB) Transaction(f func(*sql.Tx) error) error { err = f(tx) if err != nil { - log.Printf("Failed transaction: %v", err) - return err + return fmt.Errorf("Failed transaction: %w", err) } return tx.Commit() |