diff options
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/error.rs b/src/error.rs index 5aae6d8..59f4443 100644 --- a/src/error.rs +++ b/src/error.rs @@ -13,22 +13,11 @@ pub enum ServiceError { #[error("not found")] NotFound, #[error("io error: {0}")] - Io(std::io::Error), + Io(#[from] std::io::Error), #[error("bad range")] BadRange, #[error("bad utf8")] - BadUtf8, + BadUtf8(#[from] std::str::Utf8Error), #[error("ohh. i didn't expect that this error can be generated.")] Other, } - -impl From<std::io::Error> for ServiceError { - fn from(e: std::io::Error) -> Self { - Self::Io(e) - } -} -impl From<std::str::Utf8Error> for ServiceError { - fn from(_: std::str::Utf8Error) -> Self { - Self::BadUtf8 - } -} |