Resolve TODO: Do not hide error, but instantly return it

This commit is contained in:
Matthias Beyer 2016-10-19 20:11:39 +02:00
parent 7a5134ead2
commit e9519e9a3d

View file

@ -50,12 +50,15 @@ impl Hasher for MailHasher {
let filter = subject_filter.or(from_filter).or(to_filter); let filter = subject_filter.or(from_filter).or(to_filter);
let s : String = mail.headers let mut v = vec![];
.iter() for hdr in mail.headers.iter().filter(|item| filter.filter(item)) {
.filter(|item| filter.filter(item)) let s = try!(hdr.get_value()
.filter_map(|hdr| hdr.get_value().ok()) // TODO: Do not hide error here .map_err(Box::new)
.collect::<Vec<String>>() .map_err(|e| REK::RefHashingError.into_error_with_cause(e)));
.join("");
v.push(s);
}
let s : String = v.join("");
self.defaulthasher.create_hash(pb, &mut s.as_bytes()) self.defaulthasher.create_hash(pb, &mut s.as_bytes())
}) })