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

[Sass] Intelligently detect errors in --update/--watch usage.

This commit is contained in:
Nathan Weizenbaum 2010-01-24 13:43:49 -08:00
parent 2458f323d2
commit c129ffeead

View file

@ -319,7 +319,15 @@ END
::Sass::Plugin.on_creating_directory {|dirname| puts_action :directory, :green, dirname}
::Sass::Plugin.on_deleting_css {|filename| puts_action :delete, :yellow, filename}
::Sass::Plugin.on_compilation_error do |error, _, _|
raise error unless error.is_a?(::Sass::SyntaxError)
unless error.is_a?(::Sass::SyntaxError)
if error.is_a?(Errno::ENOENT) && error.message =~ /^No such file or directory - (.*)$/ && $1 == @args[1]
flag = @options[:update] ? "--update" : "--watch"
error.message << "\n Did you mean: sass #{flag} #{@args[0]}:#{@args[1]}"
end
raise error
end
puts_action :error, :red, "#{error.sass_filename} (Line #{error.sass_line}: #{error.message})"
end