File: exceptions.rb

package info (click to toggle)
ruby-pg 1.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,316 kB
  • sloc: ansic: 9,403; ruby: 3,160; makefile: 10
file content (31 lines) | stat: -rw-r--r-- 846 bytes parent folder | download
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