[Biojava-l] Errors to STDOUT in BioJava?

Thomas Down td2 at sanger.ac.uk
Sun Nov 21 06:18:59 EST 2004


On 21 Nov 2004, at 08:52, James Diggans wrote:

>
> Certainly. I was asking the list to inquire whether this was an 
> intentional design choice (i.e. making the class noisy regardless of 
> calling class) or whether anyone would be averse to fixing it to just 
> simply be:
>
> >>     } catch (Exception e) {
> >>       ExceptionFound = true;
> >>       IOExceptionFound = true;
> >>       return null;
> >>     }
>
> or, my preference, to let the exception (in a more specific 
> enbodiment, say, InvalidIDException) percolate up the stack to the 
> caller rather than being dealt with at this low level.

Hi James,

I'd certainly agree that this should be throwing an exception rather 
than returning null.  If this class were to implement the standard 
SequenceDB interface (incidentally, does anyone know why it doesn't?), 
then the getSequence method is allowed to throw IllegalIDException or 
BioException -- the `ideal' behaviour, where possible, is to throw 
IllegalIDException for the specific case of a non-existant ID being 
requested, BioException if the ID is valid but there's some other error 
getting at the data.  I don't know how easy the Genbank protocol makes 
it to distinguish the two cases.

I'll fix this at some point in the next few days, or I'd be happy to 
apply a patch if you've sorted this out yourself.

        Thomas.



More information about the Biojava-l mailing list