Exception: Moxml::XPathError
- Defined in:
- lib/moxml/error.rb
Overview
Error raised when XPath expression evaluation fails
Direct Known Subclasses
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#initialize(message, expression: nil, adapter: nil, node: nil) ⇒ XPathError
constructor
A new instance of XPathError.
- #to_s ⇒ Object
Constructor Details
#initialize(message, expression: nil, adapter: nil, node: nil) ⇒ XPathError
Returns a new instance of XPathError.
32 33 34 35 36 37 |
# File 'lib/moxml/error.rb', line 32 def initialize(, expression: nil, adapter: nil, node: nil) @expression = expression @adapter = adapter @node = node super() end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
30 31 32 |
# File 'lib/moxml/error.rb', line 30 def adapter @adapter end |
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
30 31 32 |
# File 'lib/moxml/error.rb', line 30 def expression @expression end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
30 31 32 |
# File 'lib/moxml/error.rb', line 30 def node @node end |
Instance Method Details
#to_s ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/moxml/error.rb', line 39 def to_s msg = super msg += "\n Expression: #{@expression}" if @expression msg += "\n Adapter: #{@adapter}" if @adapter msg += "\n Node: <#{@node.name}>" if @node.is_a?(Element) || @node.is_a?(Attribute) msg += "\n Hint: Verify XPath syntax and ensure the adapter supports the expression" msg end |