Add debug output to Walk::next() impl

This commit is contained in:
Matthias Beyer 2017-06-20 20:32:03 +02:00
parent 54484a6ee7
commit cac3e6114e

View file

@ -105,21 +105,26 @@ impl Iterator for Walk {
type Item = StoreObject; type Item = StoreObject;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
while let Some(something) = self.dirwalker.next() { while let Some(something) = self.dirwalker.next() {
debug!("[Walk] Processing next item: {:?}", something);
match something { match something {
Ok(next) => if next.file_type().is_dir() { Ok(next) => if next.file_type().is_dir() {
return Some(StoreObject::Collection(next.path().to_path_buf())) debug!("Found directory...");
} else if next.file_type().is_file() { return Some(StoreObject::Collection(next.path().to_path_buf()))
let n = next.path().to_path_buf(); } else /* if next.file_type().is_file() */ {
let sid = match StoreId::new(Some(self.store_path.clone()), n) { debug!("Found file...");
Err(e) => { let n = next.path().to_path_buf();
trace_error(&e); let sid = match StoreId::new(Some(self.store_path.clone()), n) {
continue; Err(e) => {
}, debug!("Could not construct StoreId object from it");
Ok(o) => o, trace_error(&e);
}; continue;
return Some(StoreObject::Id(sid)) },
}, Ok(o) => o,
};
return Some(StoreObject::Id(sid))
},
Err(e) => { Err(e) => {
warn!("Error in Walker"); warn!("Error in Walker");
debug!("{:?}", e); debug!("{:?}", e);