| 
     
      
      
      From: <jh...@us...> - 2009-11-06 19:54:30
      
     
   | 
Revision: 140
          http://etch.svn.sourceforge.net/etch/?rev=140&view=rev
Author:   jheiss
Date:     2009-11-06 19:54:22 +0000 (Fri, 06 Nov 2009)
Log Message:
-----------
Wrap exceptions from templates with a message indicating the template
and associated file names to help the user figure out where the error
occurred.  Already doing this for scripts, guess I forgot to do the same
for templates.
Modified Paths:
--------------
    trunk/server/lib/etch.rb
Modified: trunk/server/lib/etch.rb
===================================================================
--- trunk/server/lib/etch.rb	2009-11-06 01:04:05 UTC (rev 139)
+++ trunk/server/lib/etch.rb	2009-11-06 19:54:22 UTC (rev 140)
@@ -1339,7 +1339,13 @@
     # The binding arg ties the template's namespace to this point in the
     # code, thus ensuring that all of the variables above (@file, etc.)
     # are visible to the template code.
-    erb.result(binding)
+    begin
+      erb.result(binding)
+    rescue Exception => e
+      # Help the user figure out where the exception occurred, otherwise they
+      # just get told it happened here, which isn't very helpful.
+      raise e.exception("Exception while processing template #{template} for file #{@file}:\n" + e.message)
+    end
   end
 
   # This method runs a etch script (as specified via a <script> entry
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |