Merge Cant and Wont Walk.

This commit is contained in:
Tom Alexander
2020-05-09 13:51:02 -04:00
parent 2108f5cace
commit 7d63d6ef7b
3 changed files with 4 additions and 17 deletions

View File

@@ -4,13 +4,8 @@ use std::fmt;
pub enum RenderError<'a> {
Generic(String),
/// For when walking is absolutely impossible
CantWalk {
segment: String,
elem: &'a dyn ContextElement,
},
/// For when walking fails (example, a missing key on a map)
WontWalk {
CantWalk {
segment: String,
elem: &'a dyn ContextElement,
},
@@ -32,9 +27,6 @@ impl fmt::Display for RenderError<'_> {
RenderError::CantWalk { segment, elem } => {
write!(f, "Tried to walk to {} from {:?}", segment, elem)
}
RenderError::WontWalk { segment, elem } => {
write!(f, "Failed to walk to {} from {:?}", segment, elem)
}
RenderError::NotFound { path, breadcrumbs } => {
write!(f, "Could not find {:?} in {:?}", path, breadcrumbs)
}
@@ -49,9 +41,6 @@ impl fmt::Debug for RenderError<'_> {
RenderError::CantWalk { segment, elem } => {
write!(f, "Tried to walk to {} from {:?}", segment, elem)
}
RenderError::WontWalk { segment, elem } => {
write!(f, "Failed to walk to {} from {:?}", segment, elem)
}
RenderError::NotFound { path, breadcrumbs } => {
write!(f, "Could not find {:?} in {:?}", path, breadcrumbs)
}