Skip to content

AA0136 not works together with ErrorBehavior(ErrorBehavior::Collect) #7113

@TKapitan

Description

@TKapitan

1. Describe the bug
Writing second article about CollectibleErrors & ErrorInfo datatype and found AA0136 (unreachable code detection) does not work as intended - it warns that anything after the first error is not accessible even if the code is accessible due to ErrorBehavior(ErrorBehavior::Collect) setting.

2. To Reproduce
Steps to reproduce the behavior:

    [ErrorBehavior(ErrorBehavior::Collect)]
    local procedure Error4()
    begin
        Error(ErrorInfo.Create('Test error 4', true));
        Error(ErrorInfo.Create('Test error 5', true));

        /*
        Multiple errors occurred during the operation the first of which is: Test error 4. All errors can be found under 'Detailed Information'.

        Test error 4
        Test error 5

        (details removed as it's not important for this error)
        */
    end;

3. Expected behavior
Both Errors are executed so the warning about unreachable code should not be shown.

4. Actual behavior
The second line contains warning "Unreachable code detected. [AA0136]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions