TheElectronWill / night-config

Powerful java configuration library for toml, yaml, hocon, json and in-memory configurations. Serialization/deserialization framework.
GNU Lesser General Public License v3.0
242 stars 28 forks source link

Improve ParsingException by including cursor location when possible #166

Open burdoto opened 7 months ago

burdoto commented 7 months ago

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.