You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2015/12/16 15:37:47 UTC

[Issue 54060] Basic On Error does not reset for second error handler

https://bz.apache.org/ooo/show_bug.cgi?id=54060

damjan@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |damjan@apache.org
             Status|ACCEPTED                    |RESOLVED
         Resolution|---                         |NOT_AN_ISSUE
   Target Milestone|AOO PleaseHelp              |---

--- Comment #6 from damjan@apache.org ---
The way AOO Basic works with error handling (see SbiRuntime::Step()) is that
errors cannot nest: when already inside an error handler, only the parent error
handlers are searched for to handle an error, not the current one. To leave an
error handler, you must first "resume" (possibly with a label), only after that
will errors use your new error handler instead of trying to go to the parent.
In other words:

on error goto test
x = 0
y = 1/x
exit sub

test:
    on error goto test2
    msgbox "TEST: " + str(err) +" " + error
    resume r ' <--------------------------------------- These 2 lines
r:               ' <--------------------------------------- fix it
    y = 1/x
    exit sub

test2:
    msgbox "TEST2: " +str(err) +" " + error
    exit sub

Now you said this "differs from VB6". Are you sure?

>From Microsoft for VB.NET
(https://msdn.microsoft.com/en-us/library/5hsw66as.aspx)
"If the calling procedure has an enabled error handler, it is activated to
handle the error. If the calling procedure's error handler is also active,
control passes back through previous calling procedures until an enabled, but
inactive, error handler is found. If no such error handler is found, the error
is fatal at the point at which it actually occurred."

Furthermore in Microsoft Office 2007's Excel, even your example has the same
error, and mine works.

Another error is that you can't refer to err and error after using "on error"
in an error handler; that doesn't work even in Excel.

Thus resolving NOT_AN_ISSUE.

-- 
You are receiving this mail because:
You are on the CC list for the issue.