fix(config): make it clear which element in list is bad

This commit is contained in:
Weihang Lo 2025-09-23 22:11:49 -04:00
parent 22f2745066
commit bd93d31b30
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7
3 changed files with 3 additions and 3 deletions

View File

@ -2236,7 +2236,7 @@ impl ConfigValue {
toml::Value::String(val) => Ok((val, def.clone())), toml::Value::String(val) => Ok((val, def.clone())),
v => { v => {
path.push(KeyOrIdx::Idx(i)); path.push(KeyOrIdx::Idx(i));
bail!("expected string but found {} in list", v.type_str()) bail!("expected string but found {} at index {i}", v.type_str())
} }
}) })
.collect::<CargoResult<_>>()?, .collect::<CargoResult<_>>()?,

View File

@ -90,7 +90,7 @@ Caused by:
failed to parse config at `alias.b-cargo-test[0]` failed to parse config at `alias.b-cargo-test[0]`
Caused by: Caused by:
expected string but found integer in list expected string but found integer at index 0
"#]]) "#]])
.run(); .run();

View File

@ -1366,7 +1366,7 @@ Caused by:
failed to parse config at `foo[0]` failed to parse config at `foo[0]`
Caused by: Caused by:
expected string but found integer in list expected string but found integer at index 0
"#]], "#]],
); );
} }