Exception: DataObjects::SQLError

Inherits:
Error
  • Object
show all
Defined in:
lib/data_objects/error/sql_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = nil, sqlstate = nil, query = nil, uri = nil) ⇒ SQLError

Returns a new instance of SQLError.



10
11
12
13
14
15
16
# File 'lib/data_objects/error/sql_error.rb', line 10

def initialize(message, code = nil, sqlstate = nil, query = nil, uri = nil)
  @message = message
  @code = code
  @sqlstate = sqlstate
  @query = query
  @uri = uri
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/data_objects/error/sql_error.rb', line 5

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/data_objects/error/sql_error.rb', line 4

def message
  @message
end

#queryObject (readonly)

Returns the value of attribute query.



7
8
9
# File 'lib/data_objects/error/sql_error.rb', line 7

def query
  @query
end

#sqlstateObject (readonly)

Returns the value of attribute sqlstate.



6
7
8
# File 'lib/data_objects/error/sql_error.rb', line 6

def sqlstate
  @sqlstate
end

#uriObject (readonly)

Returns the value of attribute uri.



8
9
10
# File 'lib/data_objects/error/sql_error.rb', line 8

def uri
  @uri
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/data_objects/error/sql_error.rb', line 18

def to_s
  "#{message} (code: #{code}, sql state: #{sqlstate}, query: #{query}, uri: #{uri})"
end