[Biojava-dev] Errors versus Exceptions

Scooter Willis HWillis at scripps.edu
Mon May 17 12:51:28 UTC 2010


Trevor

I think this was discussed for a minimal amount of time at the Hackathon and needs more attention. I agree we should make better use of exceptions versus errors.

Scooter

On May 17, 2010, at 8:15 AM, PATERSON Trevor wrote:

> resending cos of bad headers
> 
> ________________________________
> 
> From: PATERSON Trevor 
> Sent: 17 May 2010 13:02
> To: biojava-dev at lists.open-bio.org
> Subject: Errors versus Exceptions
> 
> 
> Could I ask a quick question about why BJ3 seems to use Errors rather than Exceptions 
> - maybe this is already documented somewhere on the wiki for BJ3 or 1 - and you can point me there.
> 
> Obviously for us dataloading from remote databases we need to have a method to catch connection,sql, datamapping errors etc.
> We ususally throw DataAccessExceptions when this happens, which wrap any java.net, Ibatis and SQL exceptions.
> 
> It is difficult for us to plug in our lazyload over your signatures in the BJ3 sequence readers, as these don't throw exceptions, 
> because you seem to use Errors throughout - which dont need to be declared. Infact I cant actually see examples of you catching 
> and responding to thrown errors.
> 
> for example the setContents routine of the Sequence Readers throws a  CompoundNotFoundError if there is no mapping for a base - 
> but I can't see what is done with this.
> 
> According to the Java Lang Spec, errors are used for "serious problems that a reasonable application 
> should not try to catch" - but I would have thought finding an unrecognized base in a sequence was 
> just the sort of thing that should be thrown and caught and acted on. As error throwables are not reported 
> in the signature - developers don't have any clue ( or requirement) that they should be catching and dealing with errors - which
> seems a bit dangerous to me... If Exceptions were thrownrather than Errors that would force the developer to handle runtime errors
> 
> Cheers Trevor
> 
> -- 
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
> 
> 
> _______________________________________________
> biojava-dev mailing list
> biojava-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-dev





More information about the biojava-dev mailing list