[Catalyst] Catching exceptions

Aran Deltac aran at arandeltac.com
Sun Jun 4 06:11:56 CEST 2006


On 6/3/06, Bernhard Graf <catalyst at augensalat.de> wrote:
> Matt S Trout wrote:
>
> > check $c->error in your end action, handle it, then call
> > $c->clear_errors to prevent Catalyst generating an error screen. Note
>
> Ah! Thank you. That should work.
> Do those errors always have the following format?
>
>   Caught exception in CLASS->method "error text at Perl::Module.pm line 123"
>
> It would be more convenient, if these errors would have some kind of
> structure - e.g. an object.

These errors are trapped whenever a dispatch happens (such as handling
a URL or a $c->forward) by wrapping the call in an eval{}.  So, these
errors are just standard perl errors.  If you want, when you call
die() in your app you can pass in a hashref (or object, whatever you
want) and $c->error() will contain that data.  Its rarely used, but
nothing says you have to use a string when dieing.

Aran

> > that in the absence of this so long as your app isn't in debugging
> > mode users will see "Please come back later" in lots of languages,
> > not a dump of your app's internals.
>
> You are right. ;-)
>
> --
> Bernhard Graf
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>



More information about the Catalyst mailing list