[Templates] redirect the fatal error to browser

Ken Perl kenperl@gmail.com
Mon, 29 May 2006 09:39:48 +0800


I call it like this,
$tt->process( $input, $vars, \$output ) || die $tt->error();
but when there is a syntax error in search.xhtml template file like my
previous post, the error can't be caught, could you help?

On 5/26/06, C. Chad Wallace <cwallace@thelodgingco.com> wrote:
> Ken Perl wrote:
> > when some syntax errors in the template html file, I can't see what's
> > happened. If I go to the command line the to re-create the problem
> > then I can see the error like this,
> >
> > file error - parse error - search.xhtml line 71: unexpected end of
> > directive
> >  [% FOREACH d =3D [ '1','2','three' %]
> > so I know a ']' is missed, for other errors I may use CGI::Carp
> > qw(fatalsToBrowser); to catch the error and see it from the browser.
> > My question is how can I catch template error like above to browser?
>
> With all my scripts and templates, the errors do come to the browser
> (via CGI::Carp).  It could be that you have your Template calls
> inside an eval block.  Then when Template dies from errors, your
> script will catch the error and set $@ instead of dying out to
> CGI::Carp.
>
> We'd have a better idea of what's going on if you could post the
> code you use to load and run your templates.
>
> --
>
> C. Chad Wallace, B.Sc.
> The Lodging Company
> http://skihills.com/
> OpenPGP Public Key ID: 0x262208A0
>
> _______________________________________________
> templates mailing list
> templates@template-toolkit.org
> http://lists.template-toolkit.org/mailman/listinfo/templates
>


--=20
perl -e 'print unpack(u,"62V5N\"FME;G\!E<FQ`9VUA:6PN8V]M\"\@``
")'