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 errors for untagged enums #3

Open
cpg314 opened this issue Aug 29, 2024 · 0 comments
Open

Improve errors for untagged enums #3

cpg314 opened this issue Aug 29, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@cpg314
Copy link
Owner

cpg314 commented Aug 29, 2024

$ echo '{ select: { fields: [1, {}]  }}' |  sqlsonnet -
INFO sqlsonnet: Converting Jsonnet file - to SQL
{
   "select": {
      "fields": [
         1,
         { }
      ]
   }
}
Error:   × Failed to interpret query from JSON: data did not match any variant of untagged enum Expr at line 6 column 7
   ╭─[source.json:6:7]
 1 │ {
 2 │    "select": {
 3 │       "fields": [
 4 │          1,
 5 │          { }
 6 │       ]
   ·       ▲
 7 │    }
 8 │ }
   ╰────

This is very suboptimal, as the error points to the end of the fields list without even localizing the invalid field.

Relevant:

cpg314 added a commit that referenced this issue Aug 29, 2024
@cpg314 cpg314 added the enhancement New feature or request label Aug 29, 2024
cpg314 added a commit that referenced this issue Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant