go-toml
go-toml copied to clipboard
Add more context to type errors
Describe the issue The current error types returned are almost enough context to create a pretty-error wrapper, but not quite everything needed.
For example, StrictMissingError
returns enough context to generate an error message like this:
However, the generic DecodeError
struct, which appears for type errors, lacks additional functions to identify which key doesn't match what type, making it difficult to build a pretty-error wrapper around it.
Currently, the solution I have implemented produces the above output, but it is not very user-friendly. Adding more context to the DecodeError
struct, such as type information and the specific key responsible, would be really helpful. Additionally, I think there is a bug where DecodeError.Key()
returns an empty list for this, making it impossible to programmatically name the responsible key.
Thank you for the awesome library!