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

Enhancement: Better error reporting on invalid config files #288

Closed
wants to merge 1 commit into from

Conversation

manthanabc
Copy link
Contributor

Improves error reporting when config parsing related errors
This along with this pr will allows pest error to be visible when config file parsing fails

Current Output

thread 'main' panicked at swhkd/src/config.rs:7:80:
called `Result::unwrap()` on an `Err` value: Grammar(Error { variant: ParsingError { positives: [command], negatives: [] }, location: Pos(9), line_col: Pos((1, 10)), path: Some("/home/manth/swhkdrc"), line: "super + a; f ", continued_line: None, parse_attempts: None })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

New output

[2025-01-11T20:39:07Z ERROR swhkd] Config Error: unable to parse config file

New output after sweet with this pr

[2025-01-11T20:42:57Z ERROR swhkd] Config Error:
     --> /home/manth/swhkdrc:1:10
      |
    1 | super + a; f
      |          ^---
      |
      = expected command
    Unable to parse config file

for reference #287

@manthanabc
Copy link
Contributor Author

closing in favor of #289

@manthanabc manthanabc closed this Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant