aboutsummaryrefslogtreecommitdiff
path: root/src/guff/database.cr
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-08 04:07:04 -0500
committerPaul Duncan <pabs@pablotron.org>2016-03-08 04:07:04 -0500
commit66460b1190a958bbb84e87d01a9588dfb17f9f51 (patch)
tree02867901a69c6b9b132478d025bcc56d67e788aa /src/guff/database.cr
parent623292eb16593a02e11786116ab6efd5a14047fe (diff)
downloadold-guff-66460b1190a958bbb84e87d01a9588dfb17f9f51.tar.bz2
old-guff-66460b1190a958bbb84e87d01a9588dfb17f9f51.zip
lots more fixes, add and get posts calls work
Diffstat (limited to 'src/guff/database.cr')
-rw-r--r--src/guff/database.cr11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/guff/database.cr b/src/guff/database.cr
index 0e41b75..9201a38 100644
--- a/src/guff/database.cr
+++ b/src/guff/database.cr
@@ -123,9 +123,14 @@ module Guff
end
def transaction(&block)
- query("BEGIN")
- block.call
- query("COMMIT")
+ begin
+ query("BEGIN")
+ block.call
+ query("COMMIT")
+ rescue e
+ query("ROLLBACK")
+ raise e
+ end
end
private def run(