diff options
author | Thomas Letan <contact@thomasletan.fr> | 2020-02-08 14:35:09 +0100 |
---|---|---|
committer | Thomas Letan <contact@thomasletan.fr> | 2020-02-08 14:35:09 +0100 |
commit | c2bd648d5e30dd094d4c5e5f511cde992fffe5c6 (patch) | |
tree | 26a88954079a78e1537ecd26e97dc49ffbd572c6 | |
parent | fix: Make the static template work with untitled chapters (diff) |
feature: Print a proper message when an error occurs
-rw-r--r-- | app/src/main.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/src/main.rs b/app/src/main.rs index 0b888ab..0f21f3d 100644 --- a/app/src/main.rs +++ b/app/src/main.rs @@ -71,7 +71,7 @@ fn get_assets() -> Result<PathBuf, Error> { Ok(PathBuf::from("/usr/local/share/celtchar")) } -fn main() -> Result<(), Error> { +fn main_with_error() -> Result<(), Error> { let matches = App::new("celtchar") .version("0.1") .author("Thomas Letan") @@ -116,3 +116,10 @@ fn main() -> Result<(), Error> { Ok(()) } + +fn main() -> () { + match main_with_error() { + Err(Error(msg)) => eprintln!("error: {}", msg), + Ok(x) => x, + } +} |