Class: ActiveRecord::JDBCError

Inherits:
ActiveRecordError
  • Object
show all
Defined in:
lib/arjdbc/jdbc/base_ext.rb

Overview

Represents exceptions that have propagated up through the JDBC API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, original_exception = nil) ⇒ JDBCError

$!



27
28
29
30
# File 'lib/arjdbc/jdbc/base_ext.rb', line 27

def initialize(message = nil, original_exception = nil) # $!
  super(message)
  @original_exception = original_exception
end

Instance Attribute Details

#errnoObject

Note:

writer being used by the Java API

The vendor code or error number that came from the database.



20
21
22
# File 'lib/arjdbc/jdbc/base_ext.rb', line 20

def errno
  @errno
end

#original_exceptionObject (readonly)

Returns the value of attribute original_exception.



25
26
27
# File 'lib/arjdbc/jdbc/base_ext.rb', line 25

def original_exception
  @original_exception
end

#raw_backtraceObject (readonly)

Returns the value of attribute raw_backtrace.



25
26
27
# File 'lib/arjdbc/jdbc/base_ext.rb', line 25

def raw_backtrace
  @raw_backtrace
end

#sql_exceptionObject

Note:

writer being used by the Java API

The full Java SQLException object that was raised.



23
24
25
# File 'lib/arjdbc/jdbc/base_ext.rb', line 23

def sql_exception
  @sql_exception
end

Instance Method Details

#set_backtrace(backtrace) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/arjdbc/jdbc/base_ext.rb', line 32

def set_backtrace(backtrace)
  @raw_backtrace = backtrace
  if nested = original_exception
    backtrace = backtrace - (
      nested.respond_to?(:raw_backtrace) ? nested.raw_backtrace : nested.backtrace )
    backtrace << "#{nested.backtrace.first}: #{nested.message} (#{nested.class.name})"
    backtrace += nested.backtrace[1..-1] || []
  end
  super(backtrace)
end