diff --git a/src/renderer/errors.rs b/src/renderer/errors.rs index 8af8bb1..8041fc8 100644 --- a/src/renderer/errors.rs +++ b/src/renderer/errors.rs @@ -18,10 +18,6 @@ pub enum RenderError<'a> { path: &'a Vec<&'a str>, breadcrumbs: Vec<&'a dyn ContextElement>, }, - /// Attempting to render and unrenderable type (for example, an object without any filters) - CantRender { - elem: &'a dyn ContextElement, - }, } #[derive(Clone)] @@ -39,7 +35,6 @@ impl fmt::Display for RenderError<'_> { RenderError::WontWalk { segment, elem } => { write!(f, "Failed to walk to {} from {:?}", segment, elem) } - RenderError::CantRender { elem } => write!(f, "Cant render {:?}", elem), RenderError::NotFound { path, breadcrumbs } => { write!(f, "Could not find {:?} in {:?}", path, breadcrumbs) } @@ -57,7 +52,6 @@ impl fmt::Debug for RenderError<'_> { RenderError::WontWalk { segment, elem } => { write!(f, "Failed to walk to {} from {:?}", segment, elem) } - RenderError::CantRender { elem } => write!(f, "Cant render {:?}", elem), RenderError::NotFound { path, breadcrumbs } => { write!(f, "Could not find {:?} in {:?}", path, breadcrumbs) } diff --git a/src/renderer/renderer.rs b/src/renderer/renderer.rs index 1e18a8a..33159f3 100644 --- a/src/renderer/renderer.rs +++ b/src/renderer/renderer.rs @@ -181,7 +181,8 @@ impl<'a> DustRenderer<'a> { let injected_context = ParametersContext::new(breadcrumbs, &partial.params); let mut new_breadcrumbs = breadcrumbs.clone(); new_breadcrumbs.insert(new_breadcrumbs.len() - 1, &injected_context); - let rendered_content = self.render(&partial.name, &new_breadcrumbs)?; + // TODO: Change unwrap to ? + let rendered_content = self.render(&partial.name, &new_breadcrumbs).unwrap(); return Ok(rendered_content); } } @@ -291,7 +292,7 @@ mod tests { impl Renderable for HashMap<&str, I> { fn render(&self, _filters: &Vec) -> Result { // TODO: handle the filters - Err(RenderError::CantRender { elem: self }) + Ok("[object Object]".to_owned()) } }