Miro wrote:
So is it practice to do a Try Catch - prior to every function / procedure
call ?
No. Definitely not.
You /only/ add Catch blocks when you can do something *useful* with the
Exception if happens, as in
Sub ReloadConfiguration()
Try
' [re-]read options from file
Dim sr As New StreamReader( "file" )
. . .
sr.Close()
Catch ex As FileNotFoundException
' [Re-]Apply /default/ options here
End Try
End Sub
Catching and rethrowing an Exception in every code routine is pointless,
redundant and just slows the code down.
Logging the exception /only/ counts as "useful" if your code is
providing a [central] service for a [remote] client. The logged version
is useful to you in diagnosing the problem, but probably not to your
clients. They /might/ want to get an Exception back (re-Throw it), or
you may ahve to "translate" it into something useful to them (e.g. an
error flag in the result returned by a WebService).
HTH,
Phill W.