summaryrefslogtreecommitdiffstats
path: root/bin/core/imag-gps
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-02-03 19:53:50 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-02-11 03:22:56 +0100
commitf1a639ea8ca400db5de0864d76a8c2f374bc2bb4 (patch)
treebc0830fb6c00551b0e4e076e5c302e8438fde4e1 /bin/core/imag-gps
parent19912f5e88bf0c0f1a1c521f6f5109ee6fac8cff (diff)
Change id reporting API to return ExitCode
Because this API only errors when write!() errors occur, we can return the exit code as an error here. This way the user of the API can immediately exit if there was an IO error, but the API automatically takes care of the right return value, returning (exiting) with zero (0) if there was an "Broken pipe" error and with one (1) otherwise, which is the expected behaviour here. All calls to that API were changed accordingly. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/core/imag-gps')
-rw-r--r--bin/core/imag-gps/src/main.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/bin/core/imag-gps/src/main.rs b/bin/core/imag-gps/src/main.rs
index fe57dc1f..ac673062 100644
--- a/bin/core/imag-gps/src/main.rs
+++ b/bin/core/imag-gps/src/main.rs
@@ -138,9 +138,7 @@ fn add(rt: &Runtime) {
.set_coordinates(c.clone())
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(&id)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
});
}
@@ -175,9 +173,7 @@ fn remove(rt: &Runtime) {
let _ = writeln!(rt.stdout(), "{}", removed_value).to_exit_code().unwrap_or_exit();
}
- let _ = rt
- .report_touched(&id)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
});
}
@@ -204,9 +200,7 @@ fn get(rt: &Runtime) {
let _ = writeln!(stdout, "{}", value).to_exit_code().unwrap_or_exit();
- let _ = rt
- .report_touched(&id)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
})
}