Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve policy compiler error message for incompatible outputs. #1082

Merged

Conversation

seirl
Copy link
Collaborator

@seirl seirl commented Dec 3, 2024

The previous message was confusing to users in the situation where the output of the current block was correct, but the previous blocks had incorrect types. It made them believe that the incorrect type was the "expected" output type for the rule, and that the problem was at the error line/column.

For example, the rule:

rule:
  match:
    - condition: foo
      output: "'incorrect'"
    - condition: bar
      output: "false"
    - output: "true"

would point at the "bar" block as having the wrong type, even though the wrong type is in the "foo" block.

The new message makes it clear that the error arises from the type of the block being incompatible with the previous block types -- not with the expected output of the rule.

The previous message was confusing to users in the situation where the
output of the current block was correct, but the previous blocks had
incorrect types. It made them believe that the incorrect type was the
"expected" output type for the rule, and that the problem was at the
error line/column.

For example, the rule:

```
rule:
  match:
    - condition: foo
      output: "'incorrect'"
    - condition: bar
      output: "false"
    - output: "true"
```

would point at the "bar" block as having the wrong type, even though the
wrong type is in the "foo" block.

The new message makes it clear that the error arises from the type of
the block being incompatible with the *previous* block types -- not with
the expected output of the rule.
@seirl seirl requested a review from TristonianJones December 3, 2024 13:46
@TristonianJones TristonianJones merged commit 5910569 into google:master Dec 4, 2024
2 checks passed
@seirl seirl deleted the incompatible_outputs_better_msg branch December 5, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants