diff options
author | Teddy Wing | 2020-08-02 05:53:51 +0200 |
---|---|---|
committer | Teddy Wing | 2020-08-02 05:53:51 +0200 |
commit | 067e835956100955de01182e8fc5de89c1005249 (patch) | |
tree | 084022b1a4558b849fb2f004ea4fc6196cdbdda4 /src/bin | |
parent | 05bc296243cff9b61cb9f7d820f5bb8742b8d3f3 (diff) | |
download | git-suggestion-067e835956100955de01182e8fc5de89c1005249.tar.bz2 |
git-sugpatch: Replace `unwrap` with printed error message and exit
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/git-sugpatch.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bin/git-sugpatch.rs b/src/bin/git-sugpatch.rs index 5b95519..f5ccf93 100644 --- a/src/bin/git-sugpatch.rs +++ b/src/bin/git-sugpatch.rs @@ -25,6 +25,16 @@ fn main() { for_suggestion( &config, - |suggestion| print!("{}", suggestion.diff().unwrap()), + |suggestion| { + let diff = match suggestion.diff() { + Ok(d) => d, + Err(e) => { + gseprintln!(e); + process::exit(exitcode::UNAVAILABLE); + }, + }; + + print!("{}", diff); + }, ); } |