No subject


Thu Feb 23 00:47:41 CET 2006


bit dodgy under mod_perl. The substitute is just to tell the request to giv=
e
up, it's a bad day.

I never though of it, but either could easily extended to email me without
actually sending much more info than "you better look in the logs, mate"


On 3/16/06, Phil Mitchell <phil at 2people.org> wrote:
>
> On 3/15/06, Andreas Jellinghaus <aj at ciphirelabs.com> wrote:
> >
> >
> > What are your recommendations, how should I replace
> > my "or die" code? It is important to me to give
> > some feedback to the user that something went wrong,
> > and - to be sure - create a proper entry in some
> > log file, e.g. apache error log (catalyst running
> > with mod_perl inside apache).
>
>
> It's a good question, and I'd like to see more examples of what people do=
,
> and maybe a best practice. Instead of die, my app throws named exceptions
> (cf. Exception::Class), which are easy to catch, and you can provide
> appropriate error msgs to the user based on what type of exception you
> caught.
>
> Every one of my controller actions looks basically like this:
>
> sub foo : Local {
>    eval {
>        ... do all the foo stuff, and throw exceptions where necessary
> };
> if ($@) {
>    my $err =3D $@;
>    if ($err->isa(MyApp::Exception::File) {
>        $msg =3D "Could not open that file";
>    }
>     elsif ($err->isa(MyApp::Exception::Number) {
>        ...
>    }
>   ... etc.
> }
>
> Of course there are other ways to return error values, and it's a
> judgement call which way to choose -- but in places where you're inclined=
 to
> call "die", this works very nicely.
>
> --phil
>
> Regards, Andreas
> >
> > _______________________________________________
> > Catalyst mailing list
> > Catalyst at lists.rawmode.org
> > http://lists.rawmode.org/mailman/listinfo/catalyst
> >
>
>
>
> --
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
> http://www.2people.org
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
>
>


--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131

------=_Part_845_3988389.1142543694567
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Not a catalyst app, but mod_perl - my current project has a small &quot;err=
or&quot; module that has a couple of methods :<br><br>warn logs to the erro=
r file with the name of the calling code, but lets the request carry on<br>
fatal logs and terminates the request without killing the process. <br><br>=


More information about the Catalyst mailing list