lib/grumlin/traversal_start.rb in grumlin-1.0.0.rc2 vs lib/grumlin/traversal_start.rb in grumlin-1.0.0.rc3

- old
+ new

@@ -10,18 +10,22 @@ raise AlreadyBoundToTransactionError if @session_id transaction = tx_class.new(self.class, pool: @pool, middlewares: @middlewares) return transaction unless block_given? + result = nil + begin - yield transaction.begin + result = yield transaction.begin rescue Grumlin::Rollback transaction.rollback + result rescue StandardError transaction.rollback raise else transaction.commit + result end end def to_s(*) self.class.to_s