1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
# -*- ruby -*-
# frozen_string_literal: true
require 'pg' unless defined?( PG )
module PG
class Error < StandardError
def initialize(msg=nil, connection: nil, result: nil)
@connection = connection
@result = result
super(msg)
end
end
class NotAllCopyDataRetrieved < PG::Error
end
class LostCopyState < PG::Error
end
class NotInBlockingMode < PG::Error
end
# PG::Connection#transaction uses this exception to distinguish a deliberate rollback from other exceptional situations.
# Normally, raising an exception will cause the .transaction method to rollback the database transaction and pass on the exception.
# But if you raise an PG::RollbackTransaction exception, then the database transaction will be rolled back, without passing on the exception.
class RollbackTransaction < StandardError
end
end # module PG
|