Exception: SmarterJSON::ParseError

Inherits:
Error
  • Object
show all
Defined in:
lib/smarter_json/errors.rb

Overview

Raised by process / process_file on genuinely unparseable input (unterminated string, mismatched bracket, …). Carries the line and column when known.

Direct Known Subclasses

EncodingError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, line = nil, col = nil) ⇒ ParseError

Returns a new instance of ParseError.



15
16
17
18
19
# File 'lib/smarter_json/errors.rb', line 15

def initialize(message, line = nil, col = nil)
  @line = line
  @col = col
  super(line && col ? "#{message} at line #{line}, col #{col}" : message)
end

Instance Attribute Details

#colObject (readonly)

Returns the value of attribute col.



13
14
15
# File 'lib/smarter_json/errors.rb', line 13

def col
  @col
end

#lineObject (readonly)

Returns the value of attribute line.



13
14
15
# File 'lib/smarter_json/errors.rb', line 13

def line
  @line
end