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.
113 114 115 116 117 |
# File 'lib/moxml/error.rb', line 113 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.
111 112 113 |
# File 'lib/moxml/error.rb', line 111 def attempted_operation @attempted_operation end |
#current_state ⇒ Object (readonly)
Returns the value of attribute current_state.
111 112 113 |
# File 'lib/moxml/error.rb', line 111 def current_state @current_state end |
Instance Method Details
#to_s ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/moxml/error.rb', line 119 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 |