Exception: Cubrid2::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cubrid2/error.rb

Constant Summary collapse

ENCODE_OPTS =
{
  undef: :replace,
  invalid: :replace,
  replace: '?'.freeze
}.freeze
ConnectionError =
Class.new(Error)
TimeoutError =
Class.new(Error)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, server_version = nil, error_number = nil, sql_state = nil) ⇒ Error

Returns a new instance of Error.



78
79
80
81
82
83
84
# File 'lib/cubrid2/error.rb', line 78

def initialize(msg, server_version = nil, error_number = nil, sql_state = nil)
  @server_version = server_version
  @error_number = error_number
  @sql_state = sql_state ? sql_state.encode(**ENCODE_OPTS) : nil

  super msg
end

Instance Attribute Details

#error_numberObject (readonly) Also known as: err_code

Returns the value of attribute error_number.



12
13
14
# File 'lib/cubrid2/error.rb', line 12

def error_number
  @error_number
end

#sql_stateObject (readonly)

Returns the value of attribute sql_state.



12
13
14
# File 'lib/cubrid2/error.rb', line 12

def sql_state
  @sql_state
end