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 YAML parsing error message #9566

Merged
merged 2 commits into from
May 3, 2024
Merged

Improve YAML parsing error message #9566

merged 2 commits into from
May 3, 2024

Conversation

cscheid
Copy link
Collaborator

@cscheid cscheid commented May 2, 2024

Closes #9496.

@cscheid
Copy link
Collaborator Author

cscheid commented May 2, 2024

This is the new error message.

$ quarto render issue-9496.qmd
ERROR: YAML Parse Error: block has incorrect key formatting (issue-9496.qmd, 8:3)
 8: #| message: FALSE
 9: #| echo:false
       ~~~~~~~~~~
10: cat("HIIII")
ℹ Is it possible you missed a space after a colon in the key-value mapping?

Because I got thoroughly confused about our stack traces while debugging this issue, I also improved our stack trace printing debugging API so that it automatically highlights changes from one call to the next if called like getStack("ansi"). There's also getStack("json") if an array of objects is wanted for further processing.

Consecutive calls now look like this (actually slightly better; this screenshot has misaligned colons that are fixed in this PR):

image

@cderv

This comment was marked as resolved.

@cscheid
Copy link
Collaborator Author

cscheid commented May 3, 2024

@cderv It's only an internal debugging aid right now. Add console.log(getStack("ansi"))

@cscheid cscheid merged commit fd6d0a2 into main May 3, 2024
47 checks passed
@cscheid cscheid deleted the bugfix/9496 branch May 3, 2024 20:05
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.

Bad YAML error in the presence of parse error
2 participants