summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-05-30 10:44:47 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-05-30 11:12:46 +0200
commita157b232580dc0b737927ee1170da90feaef343e (patch)
tree185ad9f9740b276bbeeedcaea76a8e6b8470caf8
parent3e22fbe3525ed56acd0acfac6649d9d02aef461f (diff)
downloadimag-a157b232580dc0b737927ee1170da90feaef343e.tar.gz
imag-a157b232580dc0b737927ee1170da90feaef343e.tar.xz
-rw-r--r--bin/core/imag-view/src/main.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/bin/core/imag-view/src/main.rs b/bin/core/imag-view/src/main.rs
index b79ce3f9..32377c35 100644
--- a/bin/core/imag-view/src/main.rs
+++ b/bin/core/imag-view/src/main.rs
@@ -209,9 +209,9 @@ fn main() {
.map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
}
- viewer
- .view_entry(&entry, &mut outlock)
- .map_err_trace_exit_unwrap();
+ if let Err(e) = viewer.view_entry(&entry, &mut outlock) {
+ handle_error(e);
+ }
rt.report_touched(entry.get_location()).unwrap_or_exit();
});
@@ -243,9 +243,9 @@ fn main() {
.map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
}
- viewer
- .view_entry(&entry, &mut outlock)
- .map_err_trace_exit_unwrap();
+ if let Err(e) = viewer.view_entry(&entry, &mut outlock) {
+ handle_error(e);
+ }
rt.report_touched(entry.get_location()).unwrap_or_exit();
});
@@ -285,3 +285,11 @@ fn create_tempfile_for<'a>(entry: &FileLockEntry<'a>, view_header: bool, hide_co
(tmpfile, file_path)
}
+fn handle_error(e: ::libimagentryview::error::Error) {
+ use libimagentryview::error::Error;
+ match e {
+ Error::Io(e) => Err(e).to_exit_code().unwrap_or_exit(),
+ Error::Other(e) => Err(e).map_err_trace_exit_unwrap()
+ }
+}
+