Commit 96588247 authored by Audrey Tang's avatar Audrey Tang
Browse files

Do not crash the application when Template parsing failed; instead

  capture the error and handle it with $RT::Logger->error().

git-svn-id: svn+ssh://svn.bestpractical.com/svn/bps-public/rt/branches/rt-3.3@744 e417ac7c-1bcc-0310-8ffa-8f5827389a85
parent f422b1b5
......@@ -392,7 +392,15 @@ sub _ParseContent {
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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment