79357021

Date: 2025-01-15 03:54:23
Score: 1
Natty:
Report link

No, it is not a good practice because it removes the wrapper exception.

The proper handling for exceptions is that you must wrap into another exception or handle another.

So we must change our signature to

public myPublicMethod(...) throws WrapperException {
  try {
    doSomething(); // this throws OtherException
  }
  catch (OtherException e) {
    throw new WrapperException(e);
  }
}
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: kolorowa