Exception: Moxml::XPath::EvaluationError

Inherits:
Error show all
Defined in:
lib/moxml/xpath/errors.rb

Overview

Error raised when XPath evaluation fails

Instance Attribute Summary collapse

Attributes inherited from Moxml::XPathError

#adapter, #expression, #node

Instance Method Summary collapse

Constructor Details

#initialize(message, expression: nil, context_node: nil, step: nil) ⇒ EvaluationError

Returns a new instance of EvaluationError.



31
32
33
34
35
# File 'lib/moxml/xpath/errors.rb', line 31

def initialize(message, expression: nil, context_node: nil, step: nil)
  @context_node = context_node
  @step = step
  super(message, expression: expression)
end

Instance Attribute Details

#context_nodeObject (readonly)

Returns the value of attribute context_node.



29
30
31
# File 'lib/moxml/xpath/errors.rb', line 29

def context_node
  @context_node
end

#stepObject (readonly)

Returns the value of attribute step.



29
30
31
# File 'lib/moxml/xpath/errors.rb', line 29

def step
  @step
end

Instance Method Details

#to_sObject



37
38
39
40
41
42
# File 'lib/moxml/xpath/errors.rb', line 37

def to_s
  msg = super
  msg += "\n  Context node: <#{@context_node.name}>" if @context_node.is_a?(Moxml::Element) || @context_node.is_a?(Moxml::Attribute)
  msg += "\n  Step: #{@step}" if @step
  msg
end