Exception: Janeway::Error

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

Overview

Base class for JSONPath query errors

Direct Known Subclasses

AST::Error, Lexer::Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Error.

Parameters:

  • message (String)

    error message

  • query (String) (defaults to: nil)

    entire query string

  • location (Location) (defaults to: nil)

    location of error



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

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

Instance Attribute Details

#locationLocation? (readonly)

Returns:



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

def location
  @location
end

#queryString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/janeway/error.rb', line 9

def query
  @query
end

Instance Method Details

#detailed_messageObject



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

def detailed_message
  msg = "Error: #{message}\nQuery: #{query}\n"
  msg += "#{' ' * location.col}^" if @location
  msg
end