[Templates] Return of the error() method
Jonas Liljegren
jonas@paranormal.se
Tue, 15 Aug 2000 17:20:24 +0200 (CEST)
On Tue, 15 Aug 2000, Andy Wardley wrote:
> On Aug 15, 4:55pm, Jonas Liljegren wrote:
> > I found one instance there my new $template returned a Template::Exception
> > from a call to $template->error() and another there it returned the
> > Template::Exception as_string().
>
> If the template that you name in the call to process() doesn't
> exist then you get a simple string returned. This should really
> be an exception (i.e. it's a bug which will get fixed RSN)
>
> $template->process('nofile')
> || die $template->error(); # returns "nofile: not found"
>
> But everything else *should* be passed back as an exception object.
It doesn't:
print $q->header;
$template->process($handler, $params)
or do
{
my $error = $template->error();
$result->error($error->type(),
$error->info().
$error->text());
$template->process('error.html', $params)
or die( "Fatal template error: ".
$template->error()."\n");
};
And $error turns out to be a string:
[Tue Aug 15 17:14:13 2000] [error] Can't locate object method "type" via
package "parse error: adminlist.html line 3-6: unexpected token (name)
...
--
/ Jonas - http://jonas.liljegren.org/myself/en/index.html