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

assert should manifest the error message #146

Closed
szeiger opened this issue Mar 9, 2022 · 0 comments · Fixed by #170
Closed

assert should manifest the error message #146

szeiger opened this issue Mar 9, 2022 · 0 comments · Fixed by #170

Comments

@szeiger
Copy link
Collaborator

szeiger commented Mar 9, 2022

assert is specified as desugaring to error. We handle error correctly in Sjsonnet: The error message is manifested as a string. But in the case of assert we cast it to a string instead, so it does not work for other types.

Compiling error {a: "b"}:

sjsonnet.Error: {"a": "b"}
    at [Error].(foo:1:1)
RUNTIME ERROR: {"a": "b"}
	foo:1:1-15

Compiling assert 1 == 2 : { a: "b"}; 1:

sjsonnet.Error: Expected string, found object
    at [AssertExpr].(foo:1:1)
RUNTIME ERROR: {"a": "b"}
	foo:1:1-29
lihaoyi-databricks added a commit that referenced this issue Jun 1, 2023
These are meant to get materialized, similar to `error` which we already
handle correctly.

Added a unit test.

Fixes #146
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 a pull request may close this issue.

1 participant