Skip to content

Include source location information in CST->AST errors #465

@john-h-kastner-aws

Description

@john-h-kastner-aws

Category

Other

Describe the feature you'd like to request

The CST tracks the byte offset in the input where nodes originated. This information should be included in error messages to improve the debugging experience.

As a simple example, the following error should give a source location precise enough to identify which multiplication is incorrect.

john:cedar $ cargo run check-parse <<<'permit(principal, action, resource) when { 2 * principal.foo == principal.foo * principal.bar };'
Error: cedar_policy_core::parser::to_ast_err

  × failed to parse policy set
  ╰─▶ multiplication must be by an integer literal 

Describe alternatives you've considered

.

Additional context

No response

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestThis issue requets a substantial new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions