Exception: Moxml::XPath::NodeTypeError

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

Overview

Error raised when an XPath operation on unsupported node type

Instance Attribute Summary collapse

Attributes inherited from Moxml::XPathError

#adapter, #expression, #node

Instance Method Summary collapse

Constructor Details

#initialize(message, expression: nil, node_type: nil, operation: nil) ⇒ NodeTypeError

Returns a new instance of NodeTypeError.



68
69
70
71
72
# File 'lib/moxml/xpath/errors.rb', line 68

def initialize(message, expression: nil, node_type: nil, operation: nil)
  @node_type = node_type
  @operation = operation
  super(message, expression: expression)
end

Instance Attribute Details

#node_typeObject (readonly)

Returns the value of attribute node_type.



66
67
68
# File 'lib/moxml/xpath/errors.rb', line 66

def node_type
  @node_type
end

#operationObject (readonly)

Returns the value of attribute operation.



66
67
68
# File 'lib/moxml/xpath/errors.rb', line 66

def operation
  @operation
end

Instance Method Details

#to_sObject



74
75
76
77
78
79
# File 'lib/moxml/xpath/errors.rb', line 74

def to_s
  msg = super
  msg += "\n  Node type: #{@node_type}" if @node_type
  msg += "\n  Operation: #{@operation}" if @operation
  msg
end