From 2d3a19c60d59056f2926eaa5a67f66763d706758 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 1 Aug 2024 11:59:05 +0400 Subject: [PATCH] feat: add &str utf8 conv error to LibError enum --- src/error.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/error.rs b/src/error.rs index 7dcf304..fdfb0db 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,6 +4,7 @@ pub enum LibError { InvalidUrlError(InvalidUrl), StatusOutOfRange(u8), MessageNotUtf8(std::string::FromUtf8Error), + BodyNotUtf8(std::str::Utf8Error), InvalidMime(mime::FromStrError), } @@ -42,6 +43,13 @@ impl From for LibError { } } +impl From for LibError { + #[inline] + fn from(err: std::str::Utf8Error) -> Self { + Self::BodyNotUtf8(err) + } +} + impl From for LibError { #[inline] fn from(err: mime::FromStrError) -> Self {