go-toml icon indicating copy to clipboard operation
go-toml copied to clipboard

Improve error message for "toml: cannot decode array table into a ..."

Open bep opened this issue 2 years ago • 1 comments

This relates to the bug fixed in 7baa23f493a82b3f24f4dada5d0b02d17fbde175

Judging by the number of these errors that pops up in my own projects, I suspect that this error message will pop up in enough projects around to warrant a better error message, most notably an error message that includes the container key. That would make it much easier to correct for the end user. In typical configuration scenarios the user does not have much insight into the Go struct.

bep avatar Aug 17 '22 08:08 bep

Thanks for the report! Sounds a like a good time to start sprinkling more of https://github.com/pelletier/go-toml/blob/7baa23f493a82b3f24f4dada5d0b02d17fbde175/unmarshaler.go#L151 to return more specific errors.

pelletier avatar Aug 21 '22 00:08 pelletier