Re: HOWTO: Re-raise an error?



Ian Boyd wrote:
You cannot do
Err.raise

or
Err.raise Err.Number, Err.Source, Err.Description, Err.Helpfile,
Err.HelpContext

or
Dim Number
Dim Source
Dim Description
Dim Helpfile
Dim HelpContext

Number = Err.Number
Source = Err.Source
Description = Err.Description
Helpfile = Err.Helpfile
HelpContext = Err.HelpContext


Before you re-raise the error, make sure 'On Error Resume Next' is no longer
in effect...

On Error GoTo 0
Err.Raise Number, Source, Description, Helpfile, HelpContext

....otherwise you will simply throw the error back at yourself.


You can't even to

If Err.Number <> 0 Then
Dim Desc
Desc = Err.Description
Err.Raise 666, "Source is me", "Error doing thing: "&Desc
End If


How do you throw an exception?

--
Michael Harris
Microsoft MVP Scripting


.