Commit e4a1a4cb authored by Alex Vandiver's avatar Alex Vandiver
Browse files

Catch and warn about template compilation errors

RT warns when saving a template which fails to compile (for example, due
to improperly closed braces).  However, if this warning is ignored (or
the template was imported by hand from initialdata), the only hint as to
this came at the debug level:

    [debug]: Skipping Scrip #7 because it didn't Prepare

Make the template compilation error explicit, and show which template
contains the error.
parent 6f3570c5
......@@ -466,6 +466,12 @@ sub _ParseContentPerl {
TYPE => 'STRING',
SOURCE => $args{Content},
);
my ($ok) = $template->compile;
unless ($ok) {
$RT::Logger->error("Template parsing error in @{[$self->Name]} (#@{[$self->id]}): $Text::Template::ERROR");
return ( undef, $self->loc('Template parsing error: [_1]', $Text::Template::ERROR) );
}
my $is_broken = 0;
my $retval = $template->fill_in(
HASH => $args{TemplateArgs},
......
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