From ab529917847641190f21129804bbda1784b4f998 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Thu, 22 Jun 2023 21:37:10 +0100 Subject: implement atom syndication --- src/error.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index eb6f6e6..42c01b1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,3 +1,5 @@ +use std::string::FromUtf8Error; + use rocket::{http::Status, Responder}; #[derive(Responder, Debug)] @@ -8,6 +10,8 @@ pub enum BlossomError { Chrono(Status, #[response(ignore)] chrono::ParseError), Io(Status, #[response(ignore)] std::io::Error), Deserialization(Status, #[response(ignore)] toml::de::Error), + Syndicator(Status, #[response(ignore)] atom_syndication::Error), + Utf8Conversion(Status, #[response(ignore)] FromUtf8Error), NotFound(Status), NoMetadata(Status), Unimplemented(Status), @@ -48,3 +52,15 @@ impl From for BlossomError { BlossomError::Deserialization(Status::new(500), e) } } + +impl From for BlossomError { + fn from(e: atom_syndication::Error) -> Self { + BlossomError::Syndicator(Status::new(500), e) + } +} + +impl From for BlossomError { + fn from(e: FromUtf8Error) -> Self { + BlossomError::Utf8Conversion(Status::new(500), e) + } +} -- cgit