yet another template question

David Miller justdave at syndicomm.com
Tue Jan 28 22:00:32 UTC 2003


On 1/28/03 1:51 PM -0800, Jonathan Schatz wrote:

> how do i get useful error messages out of Template? i've got a template
> file that dies with this message:
>
> Template::Exception at /usr/lib/perl5/5.8.0/CGI/Carp.pm line 301.
>
> which tells me nothing. line 301 of Carp.pm is:
>
> sub realdie { CORE::die(@_); }
>
> which is also kind of useless. is there a way to to get more worthwhile
> info (or a better way to debug template files)?

Look in globals.pl for a routine called "die_with_dignity" which is
commented out.  In theory you can uncomment that and it'll give you a
traceback when a die is encountered.  Unfortunately the one that's there
got broken by some recent Bugzilla changes.  Replace it with this:

sub die_with_dignity {
    require Carp;  # for confess
    my ($err_msg) = @_;
    print $err_msg;
    confess($err_msg);
}
$::SIG{__DIE__} = \&die_with_dignity;

Be warned, it makes the error messages REALLY ugly to end users (it's
basically only useful to programmers) so you probably want to comment it
out again after you find the error.
-- 
Dave Miller      Project Leader, Bugzilla Bug Tracking System
http://www.justdave.net/             http://www.bugzilla.org/



More information about the developers mailing list