aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index cbeb6a6..9a83aff 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -10,6 +10,10 @@ pub enum ServiceError {
NotFound,
#[error("io error: {0}")]
Io(std::io::Error),
+ #[error("bad range")]
+ BadRange,
+ #[error("bad utf8")]
+ BadUtf8,
#[error("ohh. i didn't expect that this error can be generated.")]
Other,
}
@@ -19,3 +23,8 @@ impl From<std::io::Error> for ServiceError {
Self::Io(e)
}
}
+impl From<std::str::Utf8Error> for ServiceError {
+ fn from(_: std::str::Utf8Error) -> Self {
+ Self::BadUtf8
+ }
+}