How to throw new Exception gracefully
<p>How can I throw exception gracefully?</p>

<pre><code>public void Test() 
{
 if (error != 0) {
  string msg = "Error";
  throw new Exception(msg);
 }

  // Other function
  ...
}
</code></pre>

<p>I have also change the <code>throw new Exception(msg);</code> with logger</p>

<pre><code>public void Test()
{
 if (error != 0) {
  string msg = "Error";
  //throw new Exception(msg);
  logger.Error(msg);
 }

  // Other function
  ...
}
</code></pre>

<p>Should I use Exit function to exit the function when error hit?</p>

<p>Thnak you.</p>
