Exception: Archsight::Query::QueryError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/archsight/query/errors.rb

Overview

Base error class for all query-related errors

Direct Known Subclasses

EvaluationError, LexerError, ParseError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, position: nil, source: nil) ⇒ QueryError

Returns a new instance of QueryError.



7
8
9
10
11
# File 'lib/archsight/query/errors.rb', line 7

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

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



5
6
7
# File 'lib/archsight/query/errors.rb', line 5

def position
  @position
end

#sourceObject (readonly)

Returns the value of attribute source.



5
6
7
# File 'lib/archsight/query/errors.rb', line 5

def source
  @source
end

Instance Method Details

#to_sObject



13
14
15
16
17
18
19
20
# File 'lib/archsight/query/errors.rb', line 13

def to_s
  if @position && @source
    line_info = extract_line_info
    "#{super}\n#{line_info}"
  else
    super
  end
end