From 9046ac910d1c729a67583dccde496be27b0a22d6 Mon Sep 17 00:00:00 2001 From: slonkazoid Date: Sat, 20 Apr 2024 23:46:20 +0300 Subject: [PATCH] change posterror back to apperror --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 999fd73..59a8749 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,7 +63,7 @@ struct ViewPostTemplate { markdown_access: bool, } -type AppResult = Result; +type AppResult = Result; #[derive(Error, Debug)] enum AppError { @@ -71,6 +71,13 @@ enum AppError { PostError(#[from] PostError), } +impl From for AppError { + #[inline(always)] + fn from(value: std::io::Error) -> Self { + Self::PostError(PostError::IoError(value)) + } +} + #[derive(Template)] #[template(path = "error.html")] struct ErrorTemplate {