From 14db008af73d25cc92ea6c0b1f3b1e0ef67920d1 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Wed, 21 Jun 2023 19:32:30 +0100 Subject: implement foundation for posts --- src/error.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index 890a148..81cadd1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -5,6 +5,10 @@ pub enum BlossomError { Reqwest(Status, #[response(ignore)] reqwest::Error), ListenBrainz(Status, #[response(ignore)] listenbrainz::Error), Skinnyverse(Status, #[response(ignore)] mastodon_async::Error), + Chrono(Status, #[response(ignore)] chrono::ParseError), + Io(Status, #[response(ignore)] std::io::Error), + Deserialization(Status, #[response(ignore)] toml::de::Error), + NoMetadata(Status), Unimplemented(Status), } @@ -25,3 +29,21 @@ impl From for BlossomError { BlossomError::Skinnyverse(Status::new(500), e) } } + +impl From for BlossomError { + fn from(e: chrono::ParseError) -> Self { + BlossomError::Chrono(Status::new(500), e) + } +} + +impl From for BlossomError { + fn from(e: std::io::Error) -> Self { + BlossomError::Io(Status::new(500), e) + } +} + +impl From for BlossomError { + fn from(e: toml::de::Error) -> Self { + BlossomError::Deserialization(Status::new(500), e) + } +} -- cgit