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

error/0 and error/1 behavior difference #113

Closed
wader opened this issue Aug 8, 2021 · 2 comments
Closed

error/0 and error/1 behavior difference #113

wader opened this issue Aug 8, 2021 · 2 comments

Comments

@wader
Copy link
Contributor

wader commented Aug 8, 2021

jq 1.6 and master does not allow string input or argument

$ jq -n '1 | error'
jq: error (at <unknown>) (not a string): 1
$ jq -n 'error(1)'
jq: error (at <unknown>) (not a string): 1

gojq

$ ./gojq -n '1 | error'
gojq: error: 1
$ ./gojq -n 'error(1)'
gojq: error: 1

I kind of like that it's possible to throw non-string values and catch them. But maybe the difference should be documented?

@itchyny
Copy link
Owner

itchyny commented Aug 9, 2021

The exit code is same, and the behavior of gojq looks better. I think fixing it to type error does not change the behavior.

@wader
Copy link
Contributor Author

wader commented Aug 9, 2021

Agreeing, created a PR to document the difference.

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.

2 participants