[OJB-developers] Exceptions
Brought to you by:
thma
From: <Joa...@tp...> - 2002-05-07 11:29:35
|
Hy, once again I got some issues with Exception handling. There are many places in the code where Throwable is caught. I think this is quite bad, because most of the times it is just re-thrown as a different exception (often resulting in lost information). The problem is increased when the re-thrown Exception is a ODMG-Exception, as in this case we can't use the cause-exception system that I added to PersistenceBrokerException. To enhance the situation I've got two suggestions. One of them has been suggested by John Freeborg on 17. 4. 2002 (mail to be found at http://sourceforge.net/mailarchive/forum.php?thread_id=645206&forum_id=4880) but unfortunately noone anwsered and he hasn't posted since. - stop excessive use of "catch (Throwable foo)" in favour of more specific catch-clauses (see Mail-Archive-Link for details). - throw a custom subclass of ODMGException/LockNotGrantedException/... instead of the original to make use of the same mechanism that I added to PersistenceBrokerException, at least with JDK 1.4 this greatly enhances the possibilities for debugging. Unfortunately I don't know wether this is in conformance with the ODMG specification. Johns second item shouldn't be forgotten as well. regards Joachim Sauer |