Exception: Moxml::DocumentStructureError
- Defined in:
- lib/moxml/error.rb
Overview
Error raised when document structure is invalid
Instance Attribute Summary collapse
-
#attempted_operation ⇒ Object
readonly
Returns the value of attribute attempted_operation.
-
#current_state ⇒ Object
readonly
Returns the value of attribute current_state.
Instance Method Summary collapse
-
#initialize(message, operation: nil, state: nil) ⇒ DocumentStructureError
constructor
A new instance of DocumentStructureError.
- #to_s ⇒ Object
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(, operation: nil, state: nil) @attempted_operation = operation @current_state = state super() end |
Instance Attribute Details
#attempted_operation ⇒ Object (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_state ⇒ Object (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_s ⇒ Object
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 |