I generally love the way Catalyst handles errors but often I'd prefer
my first die or C::Exception to just shut everything down instead of
trundling along trying, maybe expensively, to do more which is
already destined for failure.
Is this something others might like to use? Name preference if it's
ending up on the CPAN? Other ideas? I have not written any test code
yet so I'm not even positive it would work the way I want, but I
think so.
Demo doc:
use Catalyst qw/
Your
Real
Plugins
ErrorOut
/;
sub item_at_front_of_long_chain : PathPart("whatever") : Chained
("/") : CaptureArgs(1) {
my ( $self, $c, $something ) = @_;
# ...
if ( $something eq $is_wrong )
{
$c->error_out("Really, really, really die");
}
}
Then in Catalyst::Plugin::ErrorOut, something like this:
sub error_out {
my ( $c, $msg ) = @_;
eval {
Catalyst::Exception->throw("RC_$status_code: manually thrown
error for testing");
die "Catalyst::Exception->throw failed to cause exception";
};
$c->error($@);
$c->detach();
}
–Ashley
--
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/