On Error vs On Local Error

Hello

based off of the discussion at Convert 2D array to delimited string

I noticed that we have a function which has
On Local Error . I have seen On Error. So what is the difference?

Thank you.

In VBA local is ignored. Never tested it in LO until now… It seems to be an older idea to provide error-handling inside subs

https://www.freebasic.net/wiki/ProPgErrorHandling

There is a help article about it, providing some explanation:

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 reading the code, I see that it is simply ignored. So the help seems to just daydream.

2 Likes

tdf#154595

3 Likes

On Error it is then

In cases like the given one (subject Convert 2D…) I will still include the “Local”, even if it only expresses my intention in the sense of what was called above a “daydream”. My related ideas may be obsolete following considerations by higher intelligence.