Error Handling problem - code example
I maintain a rather complex vb app, and I'm trying to rework how certain errors are handled.. Heres the situation: FormA.call1() calls FormB.call2() which calls FormB.call3() all of which have on error clauses... when an error occurs in FormB.call3() our error handler gets called and does some work to recover from the error and gets the application back to a usable state.
The problem is that once the error handling is complete FormB.call3() exits and I pick up where I left off in FormB.call2(). Which is not what I want to do. I'd really like to just drop everything in the call stack. (directly exit all active methods) Since I dont think thats possible, I attempted to raise another error in the FormB.call3() error clause which kicks me back up to FormB.call2()'s error clause. But I'm unable to keep this up... if I raise another error in an attempt to get me back to FormA.call1()'s error clause, I get a runtime error.
Any suggestions?
heres a code example:
FormA
Public sub call1()
on error goto call1_err
:
call FormB.call2()
:
call1_err:
exit sub
end sub
FormB
Public sub call2()
on error goto call2_err
:
call FormB.call3()
:
call2_err:
call errorHandler(err)
err.raise 1600
end sub
FormB
Public sub call3()
on error goto call3_err
:
*** throws an error ****
:
call3_err:
call errorHandler(err)
err.raise 1600
end sub
the errorhandler would check for err#1600 and do nothing for thiese cases...
Any suggestions would be welcome.
Thanks,