logo       

Re: redirect the fatal error to browser: msg#00065

Subject: Re: redirect the fatal error to browser
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Darren Chamberlain wrote:
> * Ken Perl <kenperl at gmail.com> [2006/05/25 14:45]:
>> 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 = [ '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?
> 
> Errors are not handled by TT, you need to do that in your front end.
> tpage does that for you, which is why you see the error on the command
> line.  In your CGI script, you need to do something like:
> 
>   $tt->process(...) || die $tt->error;
> 
> If you are using CGI::Carp, the die will get caught and displayed like
> you want.

Wow, you're right!  What I said was just flat wrong.  I just took
another look at my code, and it does indeed call die:

my $body = '';
unless( $tt->process( 'uploader.html', $tt_vars, \$body ) )
{
        die "Error with Template: ", $tt->error;
}

In my defense, I must say that I've been using this piece of code,
unmodified, for over a year in every TT script that I've written so
far--so you can understand how I took it for granted.

Sorry for the misinformation!
- --

C. Chad Wallace, B.Sc.
The Lodging Company
http://skihills.com/
OpenPGP Public Key ID: 0x262208A0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEdhFcKeSNHCYiCKARAlH5AJ9rnKKhINh02gG4B7EbTTgSN851iwCgx9z4
U+9S0bdeDTnFtlp7h3lWi5c=
=qZz4
-----END PGP SIGNATURE-----


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe