title: User entered value validation and level of error catching
body: <p>May I ask should the error catching code be placed at the lowest level or at the top as I am not sure what is the best practice? I prefer placing at the bottom, example a, as</p>
  
  <p>Example a</p>
  
  <blockquote>
  <pre><code>   public static void Main(string[] args)
      {
          string operation = args[0];
          int value = Convert.ToInt32(args[1]);
          if (operation == "date")
          {
              DoDate(value);
          }
          else if (operation == "month")
          {
              DoMonth(value);
          }
      }
      public static void DoMonth(int month)
      {
          if (month &lt; 1 || month &gt; 12)
          {
              throw new Exception("");
          }
      }
      public static void DoDate(int date)
      {
          if (date &lt; 1 || date &gt; 31)
          {
              throw new Exception("");
          }
      }
  </code></pre>
  </blockquote>
  
  <p>or example b</p>
  
  <blockquote>
  <pre><code>   public static void Main(string[] args)
      {
          string operation = args[0];
          int value = Convert.ToInt32(args[1]);
          if (operation == "date" &amp;&amp; (date &lt; 1 || date &gt; 12))
          {
              throw new Exception("");
          }
          else if (operation == "month" &amp;&amp; (month &lt; 1 || month &gt; 31))
          {
              throw new Exception("");
          }
          if (operation == "date")
          {
              DoDate(value);
          }
          else if (operation == "month")
          {
              DoMonth(value);
          }
      }
      public static void DoMonth(int month)
      {
      }
      public static void DoDate(int date)
      {
      }
  </code></pre>
  </blockquote>