fixed bug in error message in sub process: check caught exception for reference or scalar before processing

This commit is contained in:
David Delikat 2011-12-12 16:46:07 -06:00
parent fd98df41d3
commit db46cad887

View file

@ -722,9 +722,10 @@ sub process {
my $output;
eval { $output = $parser->process($template, $vars); };
if (my $e = Exception::Class->caught) {
$session->log->error(sprintf "Error processing template: %s, %s, %s", $self->getUrl, $self->getId, $e->error);
my $message = ref $e ? $e->error : $e;
$session->log->error(sprintf "Error processing template: %s, %s, %s", $self->getUrl, $self->getId, $message);
my $i18n = WebGUI::International->new($session, 'Asset_Template');
$output = sprintf $i18n->get('template error').$e->error, $self->getUrl, $self->getId;
$output = sprintf $i18n->get('template error').$message, $self->getUrl, $self->getId;
}
return $output;
}