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

fix: display error source for grammar errors if they exist #289

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading