Skip to content

Improve ParsingException by including cursor location when possible#166

Draft
burdoto wants to merge 3 commits into
TheElectronWill:masterfrom
burdoto:parser-indices
Draft

Improve ParsingException by including cursor location when possible#166
burdoto wants to merge 3 commits into
TheElectronWill:masterfrom
burdoto:parser-indices

Conversation

@burdoto

@burdoto burdoto commented Mar 29, 2024

Copy link
Copy Markdown

Closes #105, Closes #165

This PR introduces the Cursor interface that has methods to gather information about cursor information.
If a Cursor is passed to a ParsingException, the exception message is being appended with line and position information obtained from the Cursor at the moment when the exception is thrown.

Some internal things; such as private helper methods and some (supposedly internal) utility methods from com.electronwill.nightconfig.core.io.Utils had a new, @Nullable parameter added in order to pass a Cursor.

Documentation for added code is still missing.
Hocon tests are failing for a reason outside of this PR.
Needs in-depth testing and new unit tests.

burdoto added 3 commits March 28, 2024 20:56
some new parameters were introduced on existing methods, but only on private or internal utility methods; so that should be fine
not sure if this very niche case should be handled at all
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.

Please improve exceptions thrown by the parser Improve error messages

1 participant