I'm trying to fix my sites error reporting system to use the template
toolkit's built in exception handling (don't ask why we weren't already
using it). However, I can't seem to get my CATCH blocks to run. I have
function that gets called in a TRY block, and it occassionally dies,
returning a Template::Exception object declared as such:
die Template::Exception->new('Authenticate',{ errorString =>
$Error->{$errorCode}, errorCode => $errorCode, pkg => $pkg, line =>
$line, contextData => $cdata });
Now, the exception seems to be caught, because it doesn't propagate past
the TRY block and process() doesn't return false. But nothing in the
CATCH block gets executed (in this case, a simple error message built
from the various fields of the hash in [% error.info %]). I've tried
this without CGI::Carp imported, with no Carp at all, directly calling
CORE::die, etc. Whatever I do, the CATCH block doesn't get evaluated.
It does evaluate if I manually use a THROW directive before I call my
function that dies, so it seems that the exception handling does work.
Something must be wrong with my stuff, then. I've also tried it with
just passing a regular string to die, but the same thing happens.
Any ideas? I've gone through everything I can think of.
-Tom