title: How to write Chained Exception Java classes
body: <p>Specifically, which constructors should be overridden to qualify an exception as <a href="https://docs.oracle.com/javase/tutorial/essential/exceptions/chained.html" rel="nofollow">chainable</a>?</p>
  
  <p><code>Throwable(Throwable cause)</code>, <code>Throwable(String message, Throwable cause)</code>, or both?</p>
  
  <p>Resources:</p>
  
  <p><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html" rel="nofollow">http://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html</a>
  <a href="https://docs.oracle.com/javase/tutorial/essential/exceptions/chained.html" rel="nofollow">https://docs.oracle.com/javase/tutorial/essential/exceptions/chained.html</a></p>
  
  <hr>
  
  <blockquote>
    <p>The following example shows how to use a chained exception.:</p>
  </blockquote>
  
  <pre><code>try {
  
  } catch (IOException e) {
      throw new SampleException("Other IOException", e);
  }
  </code></pre>