[Rt-commit] [svn] r744 - rt/branches/rt-3.3/lib/RT

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Mon Apr 26 15:01:50 EDT 2004


Author: autrijus
Date: Mon Apr 26 15:01:49 2004
New Revision: 744

Modified:
   rt/branches/rt-3.3/lib/RT/Template_Overlay.pm
Log:
 ----------------------------------------------------------------------
 r4170 at not:  autrijus | 2004-04-26T18:56:10.826541Z
 
 * Do not crash the application when Template parsing failed; instead
   capture the error and handle it with $RT::Logger->error().
 
 ----------------------------------------------------------------------


Modified: rt/branches/rt-3.3/lib/RT/Template_Overlay.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Template_Overlay.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Template_Overlay.pm	Mon Apr 26 15:01:49 2004
@@ -392,7 +392,15 @@
         SOURCE => $content
     );
 
-    my $retval = $template->fill_in( PACKAGE => 'T' );
+    my $is_broken = 0;
+    my $retval = $template->fill_in( PACKAGE => 'T', BROKEN => sub {
+        my (%args) = @_;
+        $RT::Logger->error("Template parsing error: $args{error}")
+	    unless $args{error} =~ /^Died at /; # ignore intentional die()
+        $is_broken++;
+	return undef;
+    } );
+    return undef if $is_broken;
 
     # MIME::Parser has problems dealing with high-bit utf8 data.
     Encode::_utf8_off($retval);


More information about the Rt-commit mailing list