RDT00008: Expected error handled by the test
Severity: Hint · Family: RDT (RDCore.UnitTesting) · Raised by: ExpectedErrorAnalyzer
A test with '@ExpectedError has its own error handler: On Error GoTo a label, or On Error Resume Next.
A test with '@ExpectedError passes when the error it names leaves the test unhandled. An error the test's own handler handles never leaves the test, so the test fails as if no error were raised. A test with '@ExpectedError needs no error handler.
It is reported at the handler's statement. On Error GoTo 0 and On Error GoTo -1 handle no error and are not reported.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| A handler that jumps to a label. | '@ExpectedError VBR00011 above a test that starts with On Error GoTo TestFail. |
Remove the handler and its label: the test needs neither. |
On Error Resume Next. |
'@ExpectedError VBR00011 above a test that starts with On Error Resume Next. |
Remove the statement. |
See also
- RDT00006: Expected error not on a test