aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Letan <contact@thomasletan.fr>2020-02-08 14:35:09 +0100
committerThomas Letan <contact@thomasletan.fr>2020-02-08 14:35:09 +0100
commitc2bd648d5e30dd094d4c5e5f511cde992fffe5c6 (patch)
tree26a88954079a78e1537ecd26e97dc49ffbd572c6
parentfix: Make the static template work with untitled chapters (diff)
feature: Print a proper message when an error occurs
-rw-r--r--app/src/main.rs9
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,
+ }
+}