title: How can I make this call to log my exceptions recursive?
body: <p>I have the following code:</p>
  
  <pre><code>protected string formatException(Exception e)
  {
      var exError = "&lt;form&gt;";
          if (e == null)
          {
              throw new ArgumentNullException("e");
          }
          exError += "&lt;fieldset&gt;&lt;legend&gt;&lt;a href='#'&gt;" +
                    "&lt;span class='show-expanded'&gt;collapse message&lt;/span&gt;" +
                    "&lt;span class='show-collapsed'&gt;expand message&lt;/span&gt;" +
                    "&lt;/a&gt;&lt;/legend&gt;&lt;p&gt;" + e.Message + "&lt;/p&gt;&lt;/fieldset&gt;";
          exError += "&lt;fieldset&gt;&lt;legend&gt;&lt;a href='#'&gt;" +
                    "&lt;span class='show-expanded'&gt;collapse trace&lt;/span&gt;" +
                    "&lt;span class='show-collapsed'&gt;expand trace&lt;/span&gt;" +
                    "&lt;/a&gt;&lt;/legend&gt;&lt;p&gt;" + e.StackTrace + "&lt;/p&gt;&lt;/fieldset&gt;";
  
          if (e.InnerException != null)
          {
              // same functionality but for the inner exception and the InnerException.InnerException
          }
      return exError + "&lt;/form&gt;";
  }
  </code></pre>
  
  <p>When called it formats the exception message. However I would like to make it include the <code>InnerException</code> and the <code>InnerException.InnerException</code></p>
  
  <p>Is there some way I could do this recursively or would it be better to put the message format in another function and call that?</p>