RDC00309 — Obsolete On Local Error statement
Severity: Information · Family: RDC (Rubberduck Core analyzers) ·
Raised by: ObsoleteOnLocalErrorStatementAnalyzer
An error handler is set with On Local Error.
On Local Error GoTo Handler and On Error GoTo Handler are the same statement (MS-VBAL §5.4.4.1 On Error Statement): an
error handler is local to the procedure it is set in, as every error is, so the keyword says nothing. The syntax tree keeps it as it is written
(OnErrorGoToStatementNode.IsLocal). The diagnostic is an opinion of the analyzer and not a condition of the
language: both are legal.
Both forms are reported: On Local Error GoTo and On Local Error Resume Next. It is a suggestion because removing the keyword does not change what the statement does.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
An On Error statement is written On Local Error. |
On Local Error GoTo Handler |
Remove Local: On Error GoTo Handler. |
See also
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca