5 Replies Latest reply on Jul 27, 2006 2:22 PM by Scott Stark

    Internal exception propagation strategy

    Tim Fox Master

      This is probably a bit of a religious question, but should we:

      a) Define user defined exception types for internal interfaces such as PersistenceManager, e.g. PersistenceException and declare methods on PersistenceManager to "throw PersistenceException"

      b) Screw user defined exception types and declare internal interface methods as "throws Exception" - this may result in a method on PersistenceManager throwing a SQLException or a FileNotFoundExcepton for example.


      If we choose a) Then we need to catch other exceptions (e.g. SQLException) internally and rethrow as PersistenceException - this will involve extra messy code.

      If we choose b) Then exceptions get propagated up until they can be handled somwehere - but we end up with practically every method being declared as "throws Exception" - is this right?