Exception: Janeway::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/janeway/error.rb

Overview

Error class for Janeway. Contains a copy of the jsonpath query string. Lexer errors may also include the index into the query string that points at which token was being lexed at the time of the error.

Direct Known Subclasses

AST::Error, Lexer::Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, query = nil, location = nil) ⇒ Error

Returns a new instance of Error.

Parameters:

  • msg (String)

    error message

  • query (String) (defaults to: nil)

    entire query string

  • location (Location) (defaults to: nil)

    location of error



22
23
24
25
26
# File 'lib/janeway/error.rb', line 22

def initialize(msg, query = nil, location = nil)
  super("Jsonpath query #{query} - #{msg}")
  @query = query
  @location = location
end

Instance Attribute Details

#locationLocation? (readonly)

For lexer errors, this is the index on the query string where the error was encountered

Returns:



17
18
19
# File 'lib/janeway/error.rb', line 17

def location
  @location
end

#queryString (readonly)

JSONPath query

Returns:

  • (String)


13
14
15
# File 'lib/janeway/error.rb', line 13

def query
  @query
end