Tuesday, March 6, 2012

I just got asked to explain my choice of exception in a blog post

Today I got back to writing Bioclipse code for a while. The pile of bug reports had become big enough for a day of Bioclipse work. Among other things I added code to create the "Gists" project where newly downloaded gists are stored. That was something that had been working but which now had been forgotten in some refactoring. Anyway, as can be seen in the commit, the project.create and project.open methods throws CoreExceptions and I decided to catch them an rethrow a RuntimeException.


What also can be seen is that Egon wondered why not to throw a BioclipseException. I will now attempt to answer. However first let me say that the exception handling of Bioclipse probably is a bit of a mess...

Bioclipse exceptions are used for user friendly error messages. In my perfect world they contain an explanation of what went wrong and how to avoid similar things in the future. They are presented in a somewhat different dialog and are just generally more polished. However, in this case the error would be of the "This should not happend" sort. Meaning if we fail to create or open that project we are in great trouble and we do not want the polished error dialog but the real one with stack trace and the whole shebang.

Then again, as I said. The Exception handling of Bioclipse could really use some love and this is just my thoughts on it...




1 comment:

Followers