You have to in this case though, it's the contract on the XML:DB API interface that requires the XMLDBException and doing it any other way introduces an incompatibility between the network and embedded drivers.

On Wednesday, December 18, 2002, at 07:43  AM, Kevin Ross wrote:

Ok, my 2cents,

Don't catch and re-throw unless you have something to add, like a contextual message, or a context change (as it climbs to the top of the stack)

-Kevin

Vladimir R. Bossicard wrote:

While browsing the code (and trying to understand it) I've seen a lot of code like this one:

  public void methodname() throws XMLDBException {
    code_that_can_throw_exeception;
  }

Should we encapsulate the call between a try/catch block, like this:

  public void methodname() throws XMLDBException {
    try {
      code_that_can_throw_exeception
    } catch (Exception e) {
      throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e);
    }
  }

To respect the signature (and since we have chained exceptions)? This is of course only applicable for unchecked exceptions.

-Vladimir




Kimbro Staken
Java and XML Software, Consulting and Writing http://www.xmldatabases.org/
Apache Xindice native XML database http://xml.apache.org/xindice
XML:DB Initiative http://www.xmldb.org




Reply via email to