cyanskies / another-toml-cpp

MIT License
1 stars 0 forks source link

Improve error messages #2

Open cyanskies opened 1 year ago

cyanskies commented 1 year ago

Error messages need to be checked for level of detail. There are some instances where the error is vague, eg in parse_key_name if the parser encounters an forbidden token ('=', ']') the error reported is simply: "Illigal name".

These instance should be updated to display the parsed name.

All error messages need to be updated to include positional information. Using the example provided above, the error should look something like this: (line_number, character_column): Illigal character in key name: '='

cyanskies commented 1 year ago

Settled on the following:

[error] this shouldn't be here
Unexpected character after table header.
1>[error] this shouldn't be here
          ^~~~~~~~~~~~~~~~~~~~~^
[invalid key]
Illigal character found in table/key name: ' '.
1>[invalid key]
          ^
cyanskies commented 1 year ago

Updated the error messages of table errors as exposed by the tests in invalid/tables. 7fcc0fc69ecd539d089236f30d8cd60f20812ab6

cyanskies commented 2 months ago

There are several instances where the error message is unhelpful.

Some are listed here:

We also need to do an audit of error messages that differ between the exception and nothrow parsers.