Skip to content

Imprecise error messages of has operations #1329

@shaobo-he-aws

Description

@shaobo-he-aws

Describe the improvement you'd like to request

Consider the following ill-formed policy,

permit(principal, action, resource) when { principal has if };

The CLI reports a parsing error as follows,

  × failed to parse policy set
  ╰─▶ this identifier is reserved and cannot be used: if
   ╭────
 1 │ permit(principal, action, resource) when { principal has if };
   ·                                            ────────────────
   ╰────

The error span should ideally only cover if, as opposed to the entire has expression.

Describe alternatives you've considered

No response

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this internal improvement
  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    internal-improvementRefactoring, minor performance improvement, or other changes that Cedar users may never noticepapercutSmall annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions