Remove Local Error Quick Fix
Makes the 'Local' keyword of an 'On Error' statement implicit.
This quick-fix is available for the OnLocalError inspection
Applicability
This quick-fix can be applied as a single operation at the following scopes:- Procedure
- Module
- Project
Examples
This example depicts the state of module(s) before and after applying the quick-fix.
Before
Module1 (Any)
Option Explicit
Public Sub DoSomething()
On Local Error GoTo CleanFail
Debug.Print 42 / 0
CleanExit:
Exit Sub
CleanFail:
Debug.Print Err.Description
Resume CleanExit
End Sub
After
Module1 (Any)
Option Explicit
Public Sub DoSomething()
On Error GoTo CleanFail
Debug.Print 42 / 0
CleanExit:
Exit Sub
CleanFail:
Debug.Print Err.Description
Resume CleanExit
End Sub
Rubberduck.CodeAnalysis.QuickFixes.Concrete.RemoveLocalErrorQuickFix.cs (Prerelease-v2.5.2.6174)