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 parseError message to include position and UTF8 buffer string #859

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Madgvox
Copy link

@Madgvox Madgvox commented Jan 31, 2024

byte[]'s ToString prints System.Byte[]. This is not helpful when diagnosing the state of the parser when an error occurs, so I instead print the UTF8 encoded string version of the buffer. I also print the position for good measure.

Copy link
Collaborator

@scottf scottf left a comment

Choose a reason for hiding this comment

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

This is a good idea, but we cannot really print the buffer, it might not even be a string and it could be long.
Maybe, printing the position and length?
Also, since it's private, we can change it's signature and give more information about where it's called from, like which operation it was parsing, or even some custom information from each place it's called.

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.

None yet

2 participants