From afc413491cd0d1a66f79a9ec70c21b875905975f Mon Sep 17 00:00:00 2001 From: nex3 Date: Fri, 22 Dec 2006 01:44:07 +0000 Subject: [PATCH] Displays information about exceptions if they are thrown during rendering. git-svn-id: svn://hamptoncatlin.com/haml/trunk@237 7063305b-7217-0410-af8c-cdc13e5119b9 --- lib/sass/plugin.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/sass/plugin.rb b/lib/sass/plugin.rb index 25d97c1b..ead76486 100644 --- a/lib/sass/plugin.rb +++ b/lib/sass/plugin.rb @@ -45,7 +45,15 @@ module Sass File.delete(css) if File.exists?(css) engine = Engine.new(File.read(template_filename(name)), @@options.dup) - result = engine.render + begin + result = engine.render + rescue Exception => e + if RAILS_ENV != "production" + result = "#{e}\n\nBacktrace:\n#{e.backtrace.join("\n")}\n" + else + raise e + end + end Dir.mkdir(options[:css_location]) unless File.exist?(options[:css_location]) File.open(css, 'w') do |file|