Skip to content

Commit

Permalink
fix: display error source for grammar errors if they exist (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
lavafroth authored Jan 21, 2025
1 parent 75bcd8d commit 967040a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion swhkd/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use sweet::{Definition, SwhkdParser};
use sweet::{ModeInstruction, ParseError};

pub fn load(path: &Path) -> Result<Vec<Mode>, ParseError> {
let config_self = sweet::SwhkdParser::from(sweet::ParserInput::Path(path)).unwrap();
let config_self = sweet::SwhkdParser::from(sweet::ParserInput::Path(path))?;
parse_contents(config_self)
}

Expand Down
3 changes: 3 additions & 0 deletions swhkd/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
match config::load(&config_file_path) {
Err(e) => {
log::error!("Config Error: {}", e);
if let Some(error_source) = e.source() {
log::error!("{}", error_source);
}
exit(1)
}
Ok(out) => out,
Expand Down

0 comments on commit 967040a

Please sign in to comment.