title: Catching all the exceptions in a nested try catch and concatenating to a string
body: <p>Working on a windows application that opens various exes and operates using SendKeys. Using try catch for each exe. All exceptions messages would be mailed to the user. Something like this</p>
  
  <pre><code> private void Form1_Load(object sender, EventArgs e)
      {
          Log("start");
       try{
          #region "Process1"
          try
          {
              Log("Beginning Process1()");
              Process1();
              smtp("process 1 success");
              Log("Process1() completed");
          }
          catch(Exception ex)
          {
              ExceptionLogFile(ex.Message, "Process1()", 27, "Form1.cs");
          }
          #endregion 
  
          #region "Process2"
          try
          {
              Log("Starting Process2");
              Process2();
              smtp("process 2 success");
              Log("Process2 completed");
  
          }
          catch (Exception ex)
          {
              ExceptionLogFile(ex.Message, "Process2", 27, "Form1.cs");
          }
          #endregion
  
          #region "Process 3"
          try
          {
              Log("Starting Process3");
              Process3();
              smtp("Process 3 success");
              Log("Process3 completed");
  
          }
          catch (Exception ex)
          {
              ExceptionLogFile(ex.Message, "Process3", 61, "Form1.cs");
          }
          #endregion
  
         }
      catch(Exception ex)
       { 
        smtp(ex.Message);
        }
      }
  </code></pre>
  
  <p>The final catch block should essentially concatenate all the possible exceptions caught so that i could reduce the number of mails being triggered.</p>
  
  <p>P.S. smtp() is the method im using to generate the mail. The parameter being passed is the body of the mail</p>
  
  <pre><code>public void Process1()
      {
          Process p = Process.Start("Process1");
          p.WaitForInputIdle();
          SetParent(p.MainWindowHandle, this.Handle);
          IntPtr h = p.MainWindowHandle;
  
  
          SendKeys.Send("{TAB}");
          SendKeys.SendWait("{Enter}");
      }
  </code></pre>
  
  <p>Tab and enter are used to manipulate buttons in the window of Process1()</p>