[Catalyst] Debugging in Catalyst
Matt S Trout
dbix-class at trout.me.uk
Thu Jan 5 17:58:38 CET 2006
On Thu, Jan 05, 2006 at 11:33:25AM -0500, Joe Landman wrote:
> 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.
My experience with DBI is that it doesn't throw exceptions unless you add
RaiseError to your DBI options; if you look in Storage/DBI.pm you'll find
that pretty much everything runs through 'sub _execute' if it's doing
DBI works; I'd certainly be willing to consider a patch that checks the
$rv and throws a suitable exception if there's an error - and wrapping that
in an eval cage so exceptions can be re-thrown with extra debugging info would
also be very welcome.
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Catalyst
mailing list