426: def abort_transaction(name = nil)
427: if @__transaction_checkpoint__.nil?
428: raise TransactionError, Messages[:cannot_abort_no_transaction]
429: end
430:
431:
432:
433:
434: if @__transaction_block__ and name
435: nix = @__transaction_names__.index(name) + 1
436: if nix < @__transaction_block__
437: raise TransactionError, Messages[:cannot_abort_transaction_before_block]
438: end
439:
440: raise TransactionAborted if @__transaction_block__ == nix
441: end
442:
443: raise TransactionAborted if @__transaction_block__ == @__transaction_level__
444:
445: if name.nil?
446: __abort_transaction(name)
447: else
448: unless @__transaction_names__.include?(name)
449: raise TransactionError, Messages[:cannot_abort_named_transaction] % name.inspect
450: end
451: __abort_transaction(name) while @__transaction_names__.include?(name)
452: end
453: self
454: end