title: vb.net - error handling on main method or every method
body: <p>I have a program that is interacting with emails. I am upgrading it from <code>vb6</code> to <code>vb.net</code>. There was extensive error handling in the program before ,using <code>On Error</code> commands, to ensure that it never broke, just ignored and logged the errors. In most functions there is this <code>On Error</code> code, where it handles an error in the function by returning a default value and exiting the function. For Example:</p>
  
  <pre><code>Public Function Init() As Boolean
      On Error GoTo Err_Init
      Init = True
  Exit_Init: 
      Exit Function 
  Err_Init:
      Init = False
      Resume Exit_Init
  End Function
  </code></pre>
  
  <p>I want to change all error handling to <code>Try - Catch</code> blocks. My initial thought when I was upgrading the <code>vb6</code> code was to replace all error handling with a simple <code>Try - Catch</code> around the <code>Sub Main</code> entry point, as below:</p>
  
  <pre><code>Public Sub Main()
      Try
          Init()
      catch
          'do stuff
      end try
  End Sub
  </code></pre>
  
  <hr>
  
  <pre><code>public function Init() As boolean
      init = true
  end function 
  </code></pre>
  
  <p>as any errors in the program would be caught in this way and I could handle them all in one <code>Try - Catch</code>.</p>
  
  <p>However I then realised that, that would not make the function above return a value of <code>False</code> when an error occurred. If I still want this functionality do I have to wrap everything in <code>Try</code> blocks? </p>