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





Reply via email to