Commit f3109bb
authored
Add path context to invalid TOML config errors (#4815)
Fixes #4749.
## Summary
The old report was filed against a `spacetime.toml` path from 1.11-era
CLI flows. On current `master`, the shared TOML config parser already
returns parse failures, but the top-level error does not say which
config file was invalid.
This patch makes the shared TOML config loader add file-path context
while preserving the underlying TOML span details, so users get an error
like `invalid TOML syntax in ...` followed by the parser's line and
column information.
## Testing
- `cargo test -p spacetimedb-core
parse_config_reports_the_invalid_file_path -- --nocapture`
- manual test:
```
➜ cargo run -pspacetimedb-cli -- list
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.33s
Running `target/debug/spacetimedb-cli list`
Error: config file /home/work/.config/spacetime/cli.toml is invalid
Caused by:
TOML parse error at line 5, column 17
|
5 | [[server_configs]
| ^
invalid table header
expected `.`, `]]`
```
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>1 parent 809aebd commit f3109bb
1 file changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
310 | 315 | | |
311 | 316 | | |
312 | 317 | | |
| 318 | + | |
313 | 319 | | |
314 | 320 | | |
315 | 321 | | |
| |||
341 | 347 | | |
342 | 348 | | |
343 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
344 | 365 | | |
345 | 366 | | |
346 | 367 | | |
| |||
0 commit comments