diff options
| author | Teddy Wing | 2018-10-28 01:10:47 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-10-28 01:10:47 +0200 |
| commit | 20397f6d11e7fba2731225e03e79b1384f84d761 (patch) | |
| tree | 196c8554e3a996ca5df8adf4e678636710b46407 /src/parser.rs | |
| parent | 9c3bf2d09a21ac080ed1440c7c0df96b199e69bc (diff) | |
| download | dome-key-map-20397f6d11e7fba2731225e03e79b1384f84d761.tar.bz2 | |
MapAction::parse(): Log error instead of unwrapping
Don't panic on error. Instead display the error to the user.
Diffstat (limited to 'src/parser.rs')
| -rw-r--r-- | src/parser.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/parser.rs b/src/parser.rs index 2243201..b01b242 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -134,12 +134,17 @@ impl MapAction { Action::String(ref s) => { let input = State::new(s.as_str()); - Some( - action_map() - .easy_parse(input) - .map(|t| t.0) - .unwrap() - ) + match action_map() + .easy_parse(input) + .map(|t| t.0) + { + Ok(a) => Some(a), + Err(e) => { + dkeprintln!("{}", e); + + None + }, + } }, _ => None, }; |
