[Catalyst] Re: Perl::Rails?
phaylon
phaylon at dunkelheit.at
Fri Dec 9 23:24:56 CET 2005
Hi there,
Brandon Black said:
>
> If my controller code uses a random CPAN module, and that module does
> a "die 'foo';" somewhere inside itself, Catalyst says:
>
> [Fri Dec 9 15:37:06 2005] [catalyst] [error] Caught exception "foo at
> /path/to/Module.pm line 345"
>
> But does not provide stack context for what part of my controller code
> I was in when this error occured.
>
How about this one, it's kind of a hack (since I haven't asked a core
developer how fixed error's behaviour is) but it is a start:
use NEXT;
sub error {
my ( $c, @args ) = @_;
if ( $args[0] and $args[0] =~ /^Caught exception/ ) {
$args[0] = sprintf( 'Occured in /%s: ', $c->action )
. $args[0];
}
return $c->NEXT::error( @args );
}
This gives me, if I place a "die 'Wooo';" in my App's login controller:
[Fri Dec 9 23:21:46 2005] [catalyst] [error] Occured in /login/login:
Caught exception "Wooo at /home/p/perl/CX-Pandora/script/../lib/CX/
Pandora/Controller/Login.pm line 9."
hth, phay
More information about the Catalyst
mailing list