1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] Better handle Sass::SyntaxErrors raised outside a Sass template.

This commit is contained in:
Nathan Weizenbaum 2010-09-05 15:16:49 -07:00
parent 9c6cdc79f2
commit e0ff354c68

View file

@ -125,6 +125,7 @@ module Sass
# @return [Array<String>]
def backtrace
return nil if super.nil?
return super if sass_backtrace.all? {|h| h.empty?}
sass_backtrace.map do |h|
"#{h[:filename] || "(sass)"}:#{h[:line]}" +
(h[:mixin] ? ":in `#{h[:mixin]}'" : "")
@ -178,7 +179,9 @@ END
private
def header_string(e, options)
return "#{e.class}: #{e.message}" unless e.is_a? Sass::SyntaxError
unless e.is_a?(Sass::SyntaxError) && e.sass_line && e.sass_template
return "#{e.class}: #{e.message}"
end
line_offset = options[:line] || 1
line_num = e.sass_line + 1 - line_offset