Exception: Moxml::DocumentStructureError

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

Overview

Error raised when document structure is invalid

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, operation: nil, state: nil) ⇒ DocumentStructureError

Returns a new instance of DocumentStructureError.



134
135
136
137
138
# File 'lib/moxml/error.rb', line 134

def initialize(message, operation: nil, state: nil)
  @attempted_operation = operation
  @current_state = state
  super(message)
end

Instance Attribute Details

#attempted_operationObject (readonly)

Returns the value of attribute attempted_operation.



132
133
134
# File 'lib/moxml/error.rb', line 132

def attempted_operation
  @attempted_operation
end

#current_stateObject (readonly)

Returns the value of attribute current_state.



132
133
134
# File 'lib/moxml/error.rb', line 132

def current_state
  @current_state
end

Instance Method Details

#to_sObject



140
141
142
143
144
145
146
# File 'lib/moxml/error.rb', line 140

def to_s
  msg = super
  msg += "\n  Operation: #{@attempted_operation}" if @attempted_operation
  msg += "\n  Current State: #{@current_state}" if @current_state
  msg += "\n  Hint: Ensure the document structure follows XML specifications"
  msg
end