From: John Napiorkowski Date: Mon, 27 Jan 2014 16:42:20 +0000 (-0600) Subject: basic docs for the new exception stuff X-Git-Tag: 5.90060~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=bda80175df888e09ba36a36fd3651e1b01594486 basic docs for the new exception stuff --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 0eee708..21a1ec8 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -3436,6 +3436,28 @@ C - See L. =back +=head1 EXCEPTIONS + +Generally when you throw an exception inside an Action (or somewhere in +your stack, such as in a model that an Action is calling) that exception +is caught by Catalyst and unless you either catch it yourself (via eval +or something like L or by reviewing the L stack, it +will eventually reach L and return either the debugging +error stack page, or the default error page. However, if your exception +can be caught by L, L will +instead rethrow it so that it can be handled by that middleware (which +is part of the default middleware). For example this would allow + + use HTTP::Throwable::Factory 'http_throw'; + + sub throws_exception :Local { + my ($self, $c) = @_; + + http_throw(SeeOther => { location => + $c->uri_for($self->action_for('redirect')) }); + + } + =head1 INTERNAL ACTIONS Catalyst uses internal actions like C<_DISPATCH>, C<_BEGIN>, C<_AUTO>,