Exception: Braintrust::Vendor::Mustache::Parser::SyntaxError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/braintrust/vendor/mustache/parser.rb

Overview

A SyntaxError is raised when the Parser comes across unclosed tags, sections, illegal content in tags, or anything of that sort.

Instance Method Summary collapse

Constructor Details

#initialize(message, position) ⇒ SyntaxError

Returns a new instance of SyntaxError.



33
34
35
36
37
38
# File 'lib/braintrust/vendor/mustache/parser.rb', line 33

def initialize(message, position)
  @message = message
  @lineno, @column, @line, _ = position
  @stripped_line = @line.strip
  @stripped_column = @column - (@line.size - @line.lstrip.size)
end

Instance Method Details

#to_sObject



40
41
42
43
44
45
46
47
# File 'lib/braintrust/vendor/mustache/parser.rb', line 40

def to_s
  <<-EOF
#{@message}
  Line #{@lineno}
    #{@stripped_line}
    #{" " * @stripped_column}^
EOF
end