From 3cfe5f217caf9c21fbd1b69f51709a3f78db5c9f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 30 Oct 2018 18:40:52 +0100 Subject: [PATCH] imag-gps: Move from error-chain to failure Signed-off-by: Matthias Beyer --- bin/core/imag-gps/Cargo.toml | 1 + bin/core/imag-gps/src/main.rs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/core/imag-gps/Cargo.toml b/bin/core/imag-gps/Cargo.toml index 85822c6d..52c7d31f 100644 --- a/bin/core/imag-gps/Cargo.toml +++ b/bin/core/imag-gps/Cargo.toml @@ -26,6 +26,7 @@ log = "0.4.0" url = "1.2" toml = "0.4" toml-query = "0.7" +failure = "0.1" libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore" } libimagrt = { version = "0.9.0", path = "../../../lib/core/libimagrt" } diff --git a/bin/core/imag-gps/src/main.rs b/bin/core/imag-gps/src/main.rs index a4415594..abf121ac 100644 --- a/bin/core/imag-gps/src/main.rs +++ b/bin/core/imag-gps/src/main.rs @@ -35,6 +35,7 @@ extern crate clap; #[macro_use] extern crate log; +extern crate failure; extern crate libimagentrygps; #[macro_use] extern crate libimagrt; @@ -47,8 +48,9 @@ use std::process::exit; use std::path::PathBuf; use std::str::FromStr; -use libimagentrygps::error::GPSError as GE; -use libimagentrygps::error::GPSErrorKind as GEK; +use failure::Error; +use failure::err_msg; + use libimagentrygps::types::*; use libimagentrygps::entry::*; use libimagrt::setup::generate_runtime_setup; @@ -100,7 +102,7 @@ fn add(rt: &Runtime) { .map(|v| {debug!("Parsing = {}", v); v}) .map(FromStr::from_str) .map(|elem| { - elem.or_else(|_| Err(GE::from(GEK::NumberConversionError))) + elem.or_else(|_| Err(Error::from(err_msg("Error while converting number")))) .map_err_trace_exit_unwrap(1) }) .collect::>();