Exception: Moxml::AdapterError

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

Overview

Error raised when adapter operations fail

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, adapter: nil, operation: nil, native_error: nil) ⇒ AdapterError

Returns a new instance of AdapterError.



90
91
92
93
94
95
# File 'lib/moxml/error.rb', line 90

def initialize(message, adapter: nil, operation: nil, native_error: nil)
  @adapter_name = adapter
  @operation = operation
  @native_error = native_error
  super(message)
end

Instance Attribute Details

#adapter_nameObject (readonly)

Returns the value of attribute adapter_name.



88
89
90
# File 'lib/moxml/error.rb', line 88

def adapter_name
  @adapter_name
end

#native_errorObject (readonly)

Returns the value of attribute native_error.



88
89
90
# File 'lib/moxml/error.rb', line 88

def native_error
  @native_error
end

#operationObject (readonly)

Returns the value of attribute operation.



88
89
90
# File 'lib/moxml/error.rb', line 88

def operation
  @operation
end

Instance Method Details

#to_sObject



97
98
99
100
101
102
103
104
105
106
# File 'lib/moxml/error.rb', line 97

def to_s
  msg = super
  msg += "\n  Adapter: #{@adapter_name}" if @adapter_name
  msg += "\n  Operation: #{@operation}" if @operation
  if @native_error
    msg += "\n  Native Error: #{@native_error.class.name}: #{@native_error.message}"
  end
  msg += "\n  Hint: Ensure the adapter gem is properly installed and compatible"
  msg
end