imag-gps: Move from error-chain to failure

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2018-10-30 18:40:52 +01:00
parent 12644f22d9
commit 3cfe5f217c
2 changed files with 6 additions and 3 deletions

View file

@ -26,6 +26,7 @@ log = "0.4.0"
url = "1.2" url = "1.2"
toml = "0.4" toml = "0.4"
toml-query = "0.7" toml-query = "0.7"
failure = "0.1"
libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore" } libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore" }
libimagrt = { version = "0.9.0", path = "../../../lib/core/libimagrt" } libimagrt = { version = "0.9.0", path = "../../../lib/core/libimagrt" }

View file

@ -35,6 +35,7 @@
extern crate clap; extern crate clap;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate failure;
extern crate libimagentrygps; extern crate libimagentrygps;
#[macro_use] extern crate libimagrt; #[macro_use] extern crate libimagrt;
@ -47,8 +48,9 @@ use std::process::exit;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
use libimagentrygps::error::GPSError as GE; use failure::Error;
use libimagentrygps::error::GPSErrorKind as GEK; use failure::err_msg;
use libimagentrygps::types::*; use libimagentrygps::types::*;
use libimagentrygps::entry::*; use libimagentrygps::entry::*;
use libimagrt::setup::generate_runtime_setup; use libimagrt::setup::generate_runtime_setup;
@ -100,7 +102,7 @@ fn add(rt: &Runtime) {
.map(|v| {debug!("Parsing = {}", v); v}) .map(|v| {debug!("Parsing = {}", v); v})
.map(FromStr::from_str) .map(FromStr::from_str)
.map(|elem| { .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) .map_err_trace_exit_unwrap(1)
}) })
.collect::<Vec<i64>>(); .collect::<Vec<i64>>();