Skip to content

Incorrect terminology in error message for invalid fail statement #28220

Open
@pubudu91

Description

@pubudu91

Consider the snippet below:

public function foo(json|error data) returns json {
    if (data is error) {
        fail data;
    } else {
        return data;
    }
}

The error given to the above is:

invalid usage of the 'fail' expression operator: no matching error return type(s) in the enclosing invokable

I don't think it's correct to call it the "fail expression operator" seeing at it's a statement. Need to reword this error message to,

  1. Correct the terminology
  2. Convey what went wrong in a better way

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area/CompilerInternalInternal tasks such as code cleanup, etc #CompilerArea/DiagnosticsIssues related Diagnostics reported by the Compiler. #CompilerIceBoxOlder issues that are not being actively worked on but may be revisited in the future.Planning/SwanLakeDumpAll issues planned for Swan Lake GA releasePriority/HighTeam/CompilerFEAll issues related to Language implementation and Compiler, this exclude run times.Type/Improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions