diff options
Diffstat (limited to 'splorm/src/runtime_error.rs')
| -rw-r--r-- | splorm/src/runtime_error.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/splorm/src/runtime_error.rs b/splorm/src/runtime_error.rs index 981853d..225c2d4 100644 --- a/splorm/src/runtime_error.rs +++ b/splorm/src/runtime_error.rs @@ -43,6 +43,7 @@ pub enum RuntimeError { source: Option<bempline::ParseError>, system_path: Utf8PathBuf, }, + Generic404, Unknown, } @@ -93,6 +94,10 @@ impl RuntimeError { } } + pub fn generic_404() -> Self { + RuntimeError::Generic404 + } + pub fn unknown() -> Self { RuntimeError::Unknown } @@ -106,6 +111,7 @@ impl RuntimeError { FileErrorReason::Unknown => 500, }, Self::TemplateError { .. } => 500, + Self::Generic404 => 404, Self::Unknown => 500, } } @@ -137,6 +143,7 @@ impl fmt::Display for RuntimeError { Some(pe) => write!(f, "template error: {pe}. system={system_path}"), None => write!(f, "template error. reason={reason}, system={system_path}"), }, + RuntimeError::Generic404 => write!(f, "generic 404"), RuntimeError::Unknown => write!(f, "unknown error!"), } } @@ -166,6 +173,7 @@ impl<'re> fmt::Display for PresentableRuntimeError<'re> { FileErrorReason::Unknown => estr!(500), }, RuntimeError::TemplateError { .. } => estr!(500), + RuntimeError::Generic404 => estr!(404), RuntimeError::Unknown => estr!(500), } } |
