diff --git a/src/renderer/renderer.rs b/src/renderer/renderer.rs index c0a2a64..f430d28 100644 --- a/src/renderer/renderer.rs +++ b/src/renderer/renderer.rs @@ -210,16 +210,27 @@ fn walk_path_from_single_level<'a>( fn new_walk_path<'a>( breadcrumbs: Vec<&'a dyn ContextElement>, - path: &Vec<&str>, + path: &'a Vec<&str>, ) -> Result<&'a dyn ContextElement, RenderError<'a>> { for context in breadcrumbs.iter().rev() { match walk_path_from_single_level(*context, path)? { + // If no walking was done at all, keep looping WalkResult::NoWalk => {} - WalkResult::PartialWalk => {} - WalkResult::FullyWalked(_) => {} + // If we partially walked then stop trying to find + // anything + WalkResult::PartialWalk => { + return Err(RenderError::NotFound { + path: path, + breadcrumbs: breadcrumbs, + }) + } + WalkResult::FullyWalked(new_context) => return Ok(new_context), } } - Err(RenderError::Generic("temp".to_owned())) + Err(RenderError::NotFound { + path: path, + breadcrumbs: breadcrumbs, + }) } // TODO: rename walk_path_from_single_level