Exception: Moxml::XPath::SyntaxError

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

Overview

Error raised when XPath syntax is invalid

Instance Attribute Summary collapse

Attributes inherited from Moxml::XPathError

#adapter, #expression, #node

Instance Method Summary collapse

Constructor Details

#initialize(message, expression: nil, position: nil, token: nil) ⇒ SyntaxError

Returns a new instance of SyntaxError.



13
14
15
16
17
# File 'lib/moxml/xpath/errors.rb', line 13

def initialize(message, expression: nil, position: nil, token: nil)
  @position = position
  @token = token
  super(message, expression: expression)
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



11
12
13
# File 'lib/moxml/xpath/errors.rb', line 11

def position
  @position
end

#tokenObject (readonly)

Returns the value of attribute token.



11
12
13
# File 'lib/moxml/xpath/errors.rb', line 11

def token
  @token
end

Instance Method Details

#to_sObject



19
20
21
22
23
24
# File 'lib/moxml/xpath/errors.rb', line 19

def to_s
  msg = super
  msg += "\n  Position: #{@position}" if @position
  msg += "\n  Unexpected token: #{@token.inspect}" if @token
  msg
end