Implemented the json stringify and parse filters.
This commit is contained in:
@@ -8,6 +8,7 @@ use std::fmt;
|
||||
pub enum RenderError {
|
||||
Generic(String),
|
||||
TemplateNotFound(String),
|
||||
InvalidJson(String),
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
@@ -27,6 +28,11 @@ impl fmt::Display for RenderError {
|
||||
RenderError::TemplateNotFound(name) => {
|
||||
write!(f, "No template named {} in context", name)
|
||||
}
|
||||
RenderError::InvalidJson(invalid_json) => write!(
|
||||
f,
|
||||
"Attempted to parse the following invalid JSON: {}",
|
||||
invalid_json
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +44,11 @@ impl fmt::Debug for RenderError {
|
||||
RenderError::TemplateNotFound(name) => {
|
||||
write!(f, "No template named {} in context", name)
|
||||
}
|
||||
RenderError::InvalidJson(invalid_json) => write!(
|
||||
f,
|
||||
"Attempted to parse the following invalid JSON: {}",
|
||||
invalid_json
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user