No subject


Thu Feb 23 00:47:41 CET 2006


uot; is a bit dodgy under mod_perl. The substitute is just to tell the requ=
est to give up, it's a bad day.
<br><br>I never though of it, but either could easily extended to email me =
without actually sending much more info than &quot;you better look in the l=
ogs, mate&quot;<br><br><br><div><span class=3D"gmail_quote">On 3/16/06, <b =
class=3D"gmail_sendername">
Phil Mitchell</b> &lt;<a href=3D"mailto:phil at 2people.org">phil at 2people.org<=
/a>&gt; wrote:</span><blockquote class=3D"gmail_quote" style=3D"border-left=
: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1e=
x;">
<div style=3D"direction: ltr;"><div></div><div style=3D"direction: ltr;"><s=
pan class=3D"q"><span class=3D"gmail_quote">On 3/15/06, <b class=3D"gmail_s=
endername">Andreas Jellinghaus</b> &lt;<a href=3D"mailto:aj at ciphirelabs.com=
" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)=
">
aj at ciphirelabs.com</a>&gt; wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"><br>What are your=
 recommendations, how should I replace<br>my &quot;or die&quot; code? It is=
 important to me to give
<br>some feedback to the user that something went wrong,<br>and - to be sur=
e - create a proper entry in some<br>log file, e.g. apache error log (catal=
yst running<br>with mod_perl inside apache).</blockquote>
<div>&nbsp;</div></span></div><div style=3D"direction: ltr;">
<div>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 excepti=
ons (cf. Exception::Class), which are easy to catch, and you can provide ap=
propriate error msgs to the user based on what type of exception you caught=
.
</div>
<div>&nbsp;</div>
<div>Every one of my controller actions looks basically like this:</div>
<div>&nbsp;</div>
<div>sub foo : Local {</div>
<div>&nbsp;&nbsp; eval {</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... do all the foo stuff, and thr=
ow exceptions where necessary</div>
<div>};</div>
<div>if ($@) {</div>
<div>&nbsp;&nbsp; my $err =3D $@;</div>
<div>&nbsp;&nbsp; if ($err-&gt;isa(MyApp::Exception::File) {</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg =3D &quot;Could not open tha=
t file&quot;;</div>
<div>&nbsp;&nbsp; }</div>
<div>
<div>&nbsp;&nbsp; elsif ($err-&gt;isa(MyApp::Exception::Number) {</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;</div>
<div>&nbsp;&nbsp; }</div></div>
<div>&nbsp; ... etc.</div>
<div>}</div>
<div>&nbsp;</div>
<div>Of course there are other ways to return error values, and it's a judg=
ement call which way to choose -- but in places where you're inclined to ca=
ll &quot;die&quot;, this works very nicely.</div>
<div>&nbsp;</div>
<div>--phil</div></div><div style=3D"direction: ltr;"><span class=3D"q"><br=
>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Regards, Andreas<=
br><br>_______________________________________________<br>Catalyst mailing =
list
<br><a href=3D"mailto:Catalyst at lists.rawmode.org" target=3D"_blank" onclick=
=3D"return top.js.OpenExtLink(window,event,this)">
Catalyst at lists.rawmode.org</a><br><a href=3D"http://lists.rawmode.org/mailm=
an/listinfo/catalyst" target=3D"_blank" onclick=3D"return top.js.OpenExtLin=
k(window,event,this)">http://lists.rawmode.org/mailman/listinfo/catalyst</a=
>
<br></blockquote></span></div><div style=3D"direction: ltr;"></div></div><d=
iv style=3D"direction: ltr;"><span class=3D"sg"><br><br clear=3D"all"><br>-=
- <br>=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
<br><a href=3D"http://www.2people.org" target=3D"_blank" onclick=3D"return =
top.js.OpenExtLink(window,event,this)">http://www.2people.org</a>=20

</span></div><br>_______________________________________________<br>Catalys=
t mailing list<br><a onclick=3D"return top.js.OpenExtLink(window,event,this=
)" href=3D"mailto:Catalyst at lists.rawmode.org">Catalyst at lists.rawmode.org</a=
>
<br><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"htt=
p://lists.rawmode.org/mailman/listinfo/catalyst" target=3D"_blank">http://l=
ists.rawmode.org/mailman/listinfo/catalyst</a><br><br><br></blockquote></di=
v>
<br><br clear=3D"all"><br>-- <br>Daniel McBrearty<br>email : danielmcbreart=
y at <a href=3D"http://gmail.com">gmail.com</a><br><a href=3D"http://www.en=
goi.com">www.engoi.com</a> : the multi - language vocab trainer<br>BTW : 08=
73928131

------=_Part_845_3988389.1142543694567--



More information about the Catalyst mailing list