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

Include filename in input parse error message #3146

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wader
Copy link
Member

@wader wader commented Jun 30, 2024

Fixes #1553

@wader wader marked this pull request as draft June 30, 2024 14:32
456
EOF
cat > $d/expected_err <<EOF
jq: parse error (at $d/input_error_line2:2): Invalid numeric literal at line 4, column 0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 4 here is a bit confusing, i guess that is counting lines from all input files seen so far

jq: ignoring parse error: Truncated value at line 3, column 1
jq: ignoring parse error (at <stdin>:2): Truncated value at line 2, column 5
jq: ignoring parse error (at <stdin>:2): Truncated value at line 2, column 25
jq: ignoring parse error (at <stdin>:2): Truncated value at line 3, column 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it's at <stdin>:2 and line 3 hmm, haven dugg much but i guess it's start of new value vs where it ended somehow?

EOF
printf '1\0362 3\n[0,1\036[4,5]true"ab"{"c":4\036{}{"d":5,"e":6"false\n\036null'|$VALGRIND $Q $JQ -ces --seq '. == [2,3,[4,5],true,"ab",{},null]' > /dev/null 2> $d/out
cmp $d/out $d/expected

# Note that here jq sees no inputs at all but it still succeeds because
# --seq ignores parse errors
cat > $d/expected <<EOF
jq: ignoring parse error: Unfinished abandoned text at EOF at line 1, column 4
jq: ignoring parse error (at <stdin>:0): Unfinished abandoned text at EOF at line 1, column 4
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be <stdin>:1

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.

Enhancement: Include the file name in parse error messaging
1 participant