[CDBI] processing mysql errors

Matt S Trout dbix-class at trout.me.uk
Thu Aug 25 12:21:34 BST 2005


On Thu, Aug 25, 2005 at 12:02:20PM +0100, Dave Howorth wrote:
> I'd like to do some processing of MySQL database errors, either to 
> recover from the condition or to display a more meaningful message to a 
> user. I haven't looked into this topic before so I wondered what the 
> prior art is and whether there are any CPAN modules that might help with 
> this? I'd be grateful for any pointers :)

$dbh->err and $dbh->errstr are probably your friends here, as is overriding
sub _croak in your Class::DBI class to do something different with error
strings there.

There may also be MySQL specific stuff you can do, but you're probably better
reading the DBD docs for that.

-- 
     Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
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 ClassDBI mailing list