imag-store: Use util fn warn_exit()

This commit is contained in:
Matthias Beyer 2016-09-05 19:34:12 +02:00
parent c91de877d0
commit 0635bffd78
2 changed files with 5 additions and 12 deletions

View file

@ -3,6 +3,7 @@ use std::path::PathBuf;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
use libimagerror::trace::trace_error_exit; use libimagerror::trace::trace_error_exit;
use libimagstore::storeid::StoreId; use libimagstore::storeid::StoreId;
use libimagutil::warn_exit::warn_exit;
pub fn delete(rt: &Runtime) { pub fn delete(rt: &Runtime) {
use std::process::exit; use std::process::exit;
@ -24,14 +25,8 @@ pub fn delete(rt: &Runtime) {
exit(1); exit(1);
}) })
}) })
.or_else(|| { .or_else(|| warn_exit("No ID passed. Will exit now", 1))
warn!("No ID passed. Will exit now");
exit(1);
}) })
}) .or_else(|| warn_exit("No subcommand 'delete'. Will exit now", 1));
.or_else(|| {
warn!("No subcommand 'delete'. Will exit now");
exit(1);
});
} }

View file

@ -1,13 +1,11 @@
use std::process::exit;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
use libimagutil::warn_exit::warn_exit;
pub fn verify(rt: &Runtime) { pub fn verify(rt: &Runtime) {
if rt.store().verify() { if rt.store().verify() {
info!("Store seems to be fine"); info!("Store seems to be fine");
} else { } else {
warn!("Store seems to be broken somehow"); warn_exit("Store seems to be broken somehow", 1);
exit(1);
} }
} }