Re: HOWTO: Re-raise an error?
- From: "Michael Harris \(MVP\)" <mikhar at mvps dot org>
- Date: Fri, 1 Sep 2006 18:23:54 -0700
Ian Boyd wrote:
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.
If Err.Number <> 0 Then
On Error Goto 0
Err.Raise Err.Number, Err.Source, Err.Description, Err.HelpFile,
Err.HelpContext
End If
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'Err.Raise'
What else you got?
On Error Resume Next
x = 1/0
If Err.Number <> 0 Then
Dim ErrNumber : ErrNumber = Err.Number
Dim ErrDescription : ErrDescription = Err.Description
On Error GoTo 0
Err.Raise 666, "Source is me", ErrNumber & " : " & ErrDescription
End If
--
Michael Harris
Microsoft MVP Scripting
.
- Follow-Ups:
- Re: HOWTO: Re-raise an error?
- From: Ian Boyd
- Re: HOWTO: Re-raise an error?
- References:
- HOWTO: Re-raise an error?
- From: Ian Boyd
- Re: HOWTO: Re-raise an error?
- From: Michael Harris \(MVP\)
- Re: HOWTO: Re-raise an error?
- From: Ian Boyd
- HOWTO: Re-raise an error?
- Prev by Date: Re: Daylight Saving
- Next by Date: Re: disable keyboard and mouse while running script
- Previous by thread: Re: HOWTO: Re-raise an error?
- Next by thread: Re: HOWTO: Re-raise an error?
- Index(es):