Refactor: Use function chaining and new error type link

This commit is contained in:
Matthias Beyer 2018-01-04 23:14:02 +01:00
parent 1e2ac14d3b
commit dac817f318
2 changed files with 4 additions and 7 deletions

View file

@ -30,6 +30,7 @@ error_chain! {
foreign_links { foreign_links {
TomlQueryError(::toml_query::error::Error); TomlQueryError(::toml_query::error::Error);
UrlError(::url::ParseError);
} }
errors { errors {

View file

@ -641,13 +641,9 @@ pub mod store_check {
let mut map = HashMap::new(); let mut map = HashMap::new();
for element in iter { for element in iter {
debug!("Checking element = {:?}", element); debug!("Checking element = {:?}", element);
let entry = match element? { let entry = element?.ok_or_else(|| {
Some(e) => e, LE::from(String::from("TODO: Not yet handled"))
None => { })?;
let e = String::from("TODO: Not yet handled");
return Err(e).map_err(From::from);
},
};
debug!("Checking entry = {:?}", entry.get_location()); debug!("Checking entry = {:?}", entry.get_location());