Bug 154595 - On Local Error help is misleading
Summary: On Local Error help is misleading
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-04 06:43 UTC by Mike Kaganski
Modified: 2023-04-04 16:33 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-04-04 06:43:21 UTC
On Error help article explains the optional 'Local' keyword [1]:

> Local: "On error" is global in scope, and remains active until canceled by
> another "On error" statement. "On Local error" is local to the routine which
? invokes it. Local error handling overrides any previous global setting. When
> the invoking routine exits, the local error handling is canceled automatically,
> and any previous global setting is restored.

But this explanation is simply wrong. The code just ignores the keyword [2], and so there's no difference when it's used or not. The effects of On Error are always local to the function where it's used.

Have been documented that way since https://git.libreoffice.org/help/+/fb403a47daba6f4a3e9540a3bce180ec1970b0d4%5E%21/ (2010).

[1] https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03050500.html?DbPAR=BASIC
[2] https://opengrok.libreoffice.org/xref/core/basic/source/comp/loops.cxx?r=8ad514c6#469
Comment 1 Rafael Lima 2023-04-04 14:52:29 UTC
Indeed the interpreter simply ignores the "Local" keyword.

I did some research and it seems that even in MS VBA the "Local" keyword no longer has any effect. It simply exists for backwards compatibility.

Notice that current VBA documentation doesn't even mention the "Local" keyword.

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/on-error-statement