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

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

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

Error Handler For Entire Script


Question:

OK, how do I code this? I want a generic error handler (gosub) for the main program and also for a UDS and a UDF. Do I need different ones for each sub and func? And if so, how is it handled? What I have now doesn't seem to work properly. What have I done wrong?
#DefineSubroutine MySub()

  IntControl(73,2,0,0,0)
  ; some more code

#EndSubroutine

#DefineFunction MyFunc()

  IntControl(73,2,0,0,0)
  ; some more code

#EndFunction

;Main code
IntControl(73,2,0,0,0)
; main code

; main code is done

:WBERRORHANDLER
;error handler
;report the error
Return

Answer:

Each #DefineSubroutine and #DefineSubroutine needs its own :WBERRORHANDLER. However. You could make a #DefineSubroutine that is
#DefineSubrouine MYSPECIALERRORHANDLER()
Real error handling code goes here
#EndSubroutine
Then in the main program and in each function and subroutine you have

:WBERRORHANDLER
MYSPECIALERRORHANDLER()
return

Article ID:   W16692
File Created: 2005:02:18:12:21:52
Last Updated: 2005:02:18:12:21:52