Exception: Jekyll::Premonition::Attributes::ParserError

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

Overview

Public: Custom error for Premonition attributes parser errors.

Instance Method Summary collapse

Constructor Details

#initialize(msg, raw = nil, pos = 0) ⇒ ParserError

Initialize a new ParserError

msg - The error message raw - The raw string send to the parser initially.

Used for syntax error output. If nil syntax
error output is skipped.

pos - The buffer position when error was raised.

Used in both error message and syntax error output
if raw attribute is set.


19
20
21
22
23
24
25
26
27
28
# File 'lib/premonition/attributes/error.rb', line 19

def initialize(msg, raw = nil, pos = 0)
  if raw.nil?
    super(msg)
  else
    super("#{msg} [#{pos}:#{raw.length}]")
    print "Attribute syntax error:\n #{raw}\n"
    pos.times { print ' ' }
    print "^\n"
  end
end