Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in config file don't point to correct span #295

Closed
triallax opened this issue Jan 22, 2024 · 3 comments · Fixed by #301
Closed

Errors in config file don't point to correct span #295

triallax opened this issue Jan 22, 2024 · 3 comments · Fixed by #301
Labels
bug Something isn't working

Comments

@triallax
Copy link
Collaborator

To reproduce, write this to your config file:

intro-banner = "short"
promtp = "numbat> "
#   ^^ see the typo here

then run numbat, which will error with this output:

Error while loading /home/triallax/.config/numbat/config.toml: TOML parse error at line 1, column 1
  |
1 | intro-banner = "short"
  | ^^^^^^^^^^^^^^^^^^^^^^
unknown field `promtp`
@triallax triallax added the bug Something isn't working label Jan 22, 2024
@sharkdp
Copy link
Owner

sharkdp commented Jan 24, 2024

Thank you for reporting this. This seems to be an upstream error: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b2368bcdc7aff8aac38ed6ad1ace920b

@sharkdp
Copy link
Owner

sharkdp commented Jan 24, 2024

Yes. See:

toml-rs/toml#593
toml-rs/toml#589

@sharkdp
Copy link
Owner

sharkdp commented Jan 27, 2024

The issue seems to be related to serde's flatten feature. So if we move the MainConfig into the Config struct, that issue might be fixed. I think this would be a viable solution for us. It's not like our config needs that type of granularity right now.

eminence added a commit to eminence/numbat that referenced this issue Jan 28, 2024
This works around a known serde problem when wrong error messages
are generated with flattened fields.

See sharkdp#295 for details

Closes sharkdp#295
sharkdp pushed a commit that referenced this issue Jan 29, 2024
This works around a known serde problem when wrong error messages
are generated with flattened fields.

See #295 for details

Closes #295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants