[Catalyst] Debugging in Catalyst
Joe Landman
landman at scalableinformatics.com
Thu Jan 5 17:33:25 CET 2006
Another (related) question. While digging around in the internals of
DBIx::Class::* I noted that all of the DBI stuff is done without the
eval safety net. I mention this as I had some errors that were really
hard to catch. I have personally been using the eval { $sth = DBI->()}
bit on all DBI for a while now (several years) in large part due to the
tendency of DBI to toss exceptions if you look at it cross-eyed why it
is crunching. I look at ?@ and return it to the caller in an anonymous
hash. This has made debugging so much easier for me. The
DBIx::SimplePerl is an example of this. When something dies, you can
find out exactly what the DBI/DBD layer thought was a valid reason for
dieing.
Is there any Catalyst/DBIx method of doing something similar? Can we
define a method somewhere that catches errors, and either displays them
on the console, or logs them to a file, or displays an error page with
the error? I am not sure how to do this outside of an eval block, and I
am sure that some DBI purists disdain this method (eval). The idea is
that I don't want the application to come crashing down/commit suicide
due to some unforseen but solvable issue. I would much rather present a
pleasent and helpful error message (yup, that means we spend lots of
time writing such things, but our customers also give us meaningful
error reports as well).
Any thoughts on whether or not we can actually trap these errors?
Thanks.
Joe
Matt S Trout wrote:
> On Thu, Jan 05, 2006 at 05:07:10PM +0100, Jon Molin wrote:
>
>>Hi,
>>
>>I've noticed that when doing errors in M::DBIC::modules they don't actually
>>say what's up and exit but rather silently ignores the problem and gives
>>headache along the road. I suspect this is due to evals in catalyst? If so,
>>is there a way do make it scream about it earlier and give me the actual
>>error?
>>So, is this Catalyst or DBIx? And is there a way to make it start insulting
>>me instead of tiptoeing around and pretending everything is just fine?
>
>
> Try upgrading DBIx::Class to 0.04001 and the insults should flow freely :)
>
--
Joseph Landman, Ph.D
Founder and CEO
Scalable Informatics LLC,
email: landman at scalableinformatics.com
web : http://www.scalableinformatics.com
phone: +1 734 786 8423
fax : +1 734 786 8452
cell : +1 734 612 4615
More information about the Catalyst
mailing list