summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
new file mode 100644
index 0000000..cbeb6a6
--- /dev/null
+++ b/src/error.rs
@@ -0,0 +1,21 @@
+#[derive(Debug, thiserror::Error)]
+pub enum ServiceError {
+ #[error("hyper error")]
+ Hyper(hyper::Error),
+ #[error("unknown host")]
+ NoHost,
+ #[error("can't connect to the backend")]
+ CantConnect,
+ #[error("not found")]
+ NotFound,
+ #[error("io error: {0}")]
+ Io(std::io::Error),
+ #[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)
+ }
+}