diff options
author | cel 🌸 <cel@blos.sm> | 2023-06-22 21:37:10 +0100 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2023-06-22 21:37:10 +0100 |
commit | ab529917847641190f21129804bbda1784b4f998 (patch) | |
tree | dfdd39286d330dd62339ade0499471b70187ae04 /src/error.rs | |
parent | bc5ac494c6162743810b9aeb1cda4f22d94a486a (diff) | |
download | blossom-ab529917847641190f21129804bbda1784b4f998.tar.gz blossom-ab529917847641190f21129804bbda1784b4f998.tar.bz2 blossom-ab529917847641190f21129804bbda1784b4f998.zip |
implement atom syndication
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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<toml::de::Error> for BlossomError { BlossomError::Deserialization(Status::new(500), e) } } + +impl From<atom_syndication::Error> for BlossomError { + fn from(e: atom_syndication::Error) -> Self { + BlossomError::Syndicator(Status::new(500), e) + } +} + +impl From<FromUtf8Error> for BlossomError { + fn from(e: FromUtf8Error) -> Self { + BlossomError::Utf8Conversion(Status::new(500), e) + } +} |