Re: Can I break out of vbScript by causing error..... let me explain
- From: Superfreak3 <Matt.Walker@xxxxxxxxxxxx>
- Date: 11 May 2007 07:27:40 -0700
On May 11, 9:01 am, Superfreak3 <Matt.Wal...@xxxxxxxxxxxx> wrote:
On May 10, 8:15 pm, "Michael Harris \(MVP\)" <mikhar.at.mvps.dot.org>
wrote:
The first quick question regards 'On error resume next'. In the docs
it says that this should appear if every called function if the script
is to totally resume on error. Would or should I make the 2 additions
to my current scripts marked by '>' ?
Work with very simplistic samples until you grok the err scoping behavior
:-).
On Error Resume Next
'errors are trapped locally
wscript.echo "before SubA"
Call SubA()
wscript.echo "Err after SubA", err.number, err.description, err.source
Err.clear
wscript.echo "before SubB"
Call SubB()
wscript.echo "Err after SubB", err.number, err.description, err.source
Sub SubA()
'no local errors trapped here!
Err.Raise &hff, "SubAError", "SubA"
wscript.echo "Err in SubA", err.number, err.description, err.source
End Sub
Sub SubB()
'local errors are trapped here!
On Error Resume Next
Err.Raise &hff, "SubBError", "SubB"
wscript.echo "Err in SubB", err.number, err.description, err.source
Err.clear
End Sub
--
Michael Harris
Microsoft.MVP.Scripting
So, if I really don't care if he script kicks out an error, I should
put On Error Resume Next statements in my functions?- Hide quoted text -
- Show quoted text -
So in...
Sub SubB()
'local errors are trapped here!
On Error Resume Next
Err.Raise &hff, "SubBError", "SubB"
wscript.echo "Err in SubB", err.number, err.description,
err.source
Err.clear
End Sub
execution will continue, but in SubA() it will not?
.
- Follow-Ups:
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Michael Harris \(MVP\)
- Re: Can I break out of vbScript by causing error..... let me explain
- References:
- Can I break out of vbScript by causing error..... let me explain
- From: Superfreak3
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Mark Dormer
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Superfreak3
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Bob Barrows [MVP]
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Michael Harris \(MVP\)
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Superfreak3
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Bob Barrows [MVP]
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Superfreak3
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Superfreak3
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Michael Harris \(MVP\)
- Re: Can I break out of vbScript by causing error..... let me explain
- From: Superfreak3
- Can I break out of vbScript by causing error..... let me explain
- Prev by Date: Re: Call to VBScript fails
- Next by Date: Re: Call to VBScript fails
- Previous by thread: Re: Can I break out of vbScript by causing error..... let me explain
- Next by thread: Re: Can I break out of vbScript by causing error..... let me explain
- Index(es):
Relevant Pages
|