title: Get detail messages of chained exceptions Java
body: <p>I'd like to know how I could throw a &quot;final&quot; <code>Exception</code>, containing a detailed message with all the detailed messages of a number of chained exceptions.</p>
  <p>For example suppose a code like this:</p>
  <pre><code>try {
    try {
      try {
        try {
          //Some error here
        } catch (Exception e) {
          throw new Exception(&quot;FIRST EXCEPTION&quot;, e);
        }
      } catch (Exception e) {
        throw new Exception(&quot;SECOND EXCEPTION&quot;, e);
      }
    } catch (Exception e) {
      throw new Exception(&quot;THIRD EXCEPTION&quot;, e);
    }
  } catch (Exception e) {
    String allMessages = //all the messages
    throw new Exception(allMessages, e);
  }
  </code></pre>
  <p>I'm not interested in the full <code>stackTrace</code>, but only in the messages, I wrote. I mean, I'd like to have a result like this:</p>
  <pre><code>java.lang.Exception: THIRD EXCEPTION + SECOND EXCEPTION + FIRST EXCEPTION
  </code></pre>