title: Exception handling best practices revised
body: <p>I have a piece of code where I capture all exceptions and throw one generic exception at the end. Something like this:</p>
  
  <pre><code>try {
    // do something here
  } catch (Whatever e) {
    throw new MyException(e.getMessage());
  }
  </code></pre>
  
  <p>This kind of makes my function definition looks clean, i.e. "myFunc throws MyException" but at the same time I lose the semantics of what caused the problem. On the other hand if I just throw all exceptions, that will make the function body cleaner but the definition of the function will contain 1-5 throw statements.</p>
  
  <p>My question is: what is better?... should I capture all exceptions, keeping the function definition clean, or should I throw everything keeping the body of the function clean?</p>
  
  <p>NOTE: the second approach will also make the exception handling code for my function more difficult...</p>