1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/haml/error.rb
Nathan Weizenbaum b767fd1419 Fix error line reporting.
Syntax errors involving a line being improperly indented
were detected on the previous line,
and thus had their line numbers wrong.

Conflicts:

	lib/haml/precompiler.rb
2008-04-17 18:12:37 -07:00

27 lines
936 B
Ruby

module Haml
# The abstract type of exception raised by Haml code.
class Error < StandardError
# :stopdoc:
# By default, an error is taken to refer to the line of the template
# that was being processed when the exception was raised.
# However, if line_offset is non-zero, it's added to that line number
# to get the line to report for the error.
attr_reader :line_offset
def initialize(message = nil, line_offset = 0)
super(message)
@line_offset = line_offset
end
# :startdoc:
end
# SyntaxError is the type of exception raised when Haml encounters an
# ill-formatted document.
# It's not particularly interesting, except in that it includes Haml::Error.
class SyntaxError < Haml::Error; end
# HamlError is the type of exception raised when Haml encounters an error
# not of a syntactical nature, such as an undefined Filter.
class HamlError < Haml::Error; end
end