Centralized error handling in VB6.
Posted
by AngryHacker
on Stack Overflow
See other posts from Stack Overflow
or by AngryHacker
Published on 2010-03-29T23:46:58Z
Indexed on
2010/03/29
23:53 UTC
Read the original article
Hit count: 407
vb6
|error-handling
I have the following method that all the error handlers call:
Public Function ToError(strClass As String, strMethod As String) As String
On Error GoTo errHandle
ToError = "Err " & Err.Number & _
", Src: " & Err.Source & _
", Dsc: " & Err.Description & _
", Project: " & App.Title & _
", Class: " & strClass & _
", Method: " & strMethod & _
", Line: " & Erl
Err.Clear
exitPoint:
Exit Function
errHandle:
oLog.AddToLog "Error in ToError Method: " & Err.Description, False
Resume exitPoint
End Function
It turns out that because I declare an error handler in this function On Error GoTo errHandle
, VB6 clears the error before I am able to record it.
Is there a way to prevent the 'On Error GoTo errHandle' statement from clearing the error?
© Stack Overflow or respective owner