[Catalyst] Outputting all errors in a Catalyst application

Eric Black black.eric at gmail.com
Sun Nov 28 01:45:45 GMT 2010


Hi,

I was going through the exercises in 'The Definitive Guide to
Catalyst' and had an error that I couldn't track down at first. It
ended up being a simple typo but it was extremely difficult to track
down. I could have just diff'ed the source from online and my own
code, but I figured troubleshooting the problem would be a good way to
get more familiar with Catalyst. I added Log::Log4perl::Catalyst and
set it to debug mode which helped somewhat, but when I tracked the
problem down with the debugger, the error was:

Watchpoint 0:	$error changed:
    old value:	'Can't locate object method "HASH(0xb2f2778)" via
package "object" (perhaps you forgot to load "object"?) at
lib/LolCatalyst/Lite/Controller/Translate.pm line 46.
'
    new value:	'Can't locate object method "HASH(0xb2f2778)" via
package "object" (perhaps you forgot to load "object"?) at
lib/LolCatalyst/Lite/Controller/Translate.pm line 46.'
Catalyst::execute(/usr1/perllibs/support_notices/lib/Catalyst.pm:1672):

The only reason I found it was because I was watching the $error
variable in Catalyst.pm ver(5.80029) here (line 1672):

            unless ( ref $error ) {
                no warnings 'uninitialized';
                chomp $error;
                my $class = $last->class;
                my $name  = $last->name;
                $error = qq/Caught exception in $class->$name "$error"/;
            }
            $c->error($error);

Seems like the error should have bubbled up somehow or is there
something I have to do to get $c->error to print the error?

Thanks,
Eric



More information about the Catalyst mailing list