chshersh / tool-sync

🧰 Download pre-built binaries of all your favourite tools with a single command
https://crates.io/crates/tool-sync
Mozilla Public License 2.0
72 stars 17 forks source link

Provide more detailed TOML decoding errors #25

Closed chshersh closed 1 year ago

chshersh commented 2 years ago

Currently, when TOML decoding fails due to missing fields or mismatched values, the error doesn't specify the missing field:

Error parsing configuration at path Cargo.toml: [Decode Error]

The corresponding function also simply returns Option<Config> instead of providing more details

https://github.com/chshersh/tool-sync/blob/950b4028a619d33303548acd06056949dcec1a4a/src/config/toml.rs#L48-L64

It would provide better UX to add more details to the DecodeError constructor in the TomlError type by telling all errors that happened during decoding:

https://github.com/chshersh/tool-sync/blob/950b4028a619d33303548acd06056949dcec1a4a/src/config/toml.rs#L10-L14

Open questions:

DukeManh commented 2 years ago

Hey @chshersh, I ran into the same issue trying your tool. I'd like help with this.

chshersh commented 2 years ago

@DukeManh Sure, go for it!