WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Error Codes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Ignore Error and Return From Called Script

 Keywords: Ignore Handle Error Errors Handler Handling Return Call Called Script .WBT IntControl 73

Question:

I would like to suppress all errors in a called script. I know this can be accomplished using IntControl 73. However I would like the called script to RETURN to the main calling script upon error. The problem is that the return keyword is special to both the Called script and the Error handling GoSubs and UDFs. How can a RETRUN to the main script from a clled script upon error?

Answer:

Yes. In this specific case you will need to use the goto option provided by the IntControl 73. For example:

Foo.wbt:

Call(DirScript():'Bar.wbt','')
Message('Program Foo','Complete')
Exit

Bar.wbt:

IntControl(73,1,0,0,0)
badline=Message(aaaa,bbb)
Pause('Program Bar','Complete')
Return 999

:WBERRORHANDLER
;lasterr = wberrorarray[0]
;handlerline = wberrorarray[1]
;textstring = wberrorarray[5]
;linenumber = wberrorarray[8]
;errstr = StrCat("Number: ",lasterr,@LF,"String: ",textstring,@LF,"Line (",linenumber,"): '",handlerline,"'")
;Message("Error Information",errstr)
Return 0

Article ID:   W17868
Filename:   Ignore Error and Return From Called Script.txt
File Created: 2013:03:11:10:16:06
Last Updated: 2013:03:11:10:16:06