[Bioperl-l] bioperl-db: don't just add exceptions please
Hilmar Lapp
hlapp at gnf.org
Fri May 23 15:18:21 EDT 2003
Juguang I reverted your change in BioSQL/BasePersistenceAdaptor.pm. You
can't throw an exception there because it may arise from a valid
condition that needs to be dealt with locally, which is actually stated
if you read the code documentation a few lines downwards.
Generally speaking, bioperl-db right now can be quite noisy in the
sense that you may see lots of error messages from DBI. Believe me,
this is almost always if not always OK. All statements are checked for
their return value after execution, and proper action is taken if
required (barring any bugs ...). Please don't add throwing exceptions
after every statement in case it fails. There is no need for this. In
fact, if you do this, you introduce a bug, that you in this case didn't
see on mysql, but which surfaces immediately under Oracle.
Also, note that some drivers upon certain errors not only return a
value that evaluates to FALSE, they may also (or better, instead) throw
an exception (i.e., die). The Oracle DBD driver is an example for this.
This is why if the execution is encapsulated in an eval{}, you should
*not* propagate the exception upwards if one occurs.
For those who find bioperl-db too noisy, there is an easy way to shut
up DBI, which is where the noise comes from: edit
Bio/DB/BioSQL/DBAdaptor.pm, search for AutoCommit in the code, and add
a PrintError => 0 attribute. I'll do this for the release.
-hilmar
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------
More information about the Bioperl-l
mailing list