summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-02-24 13:23:58 +0100
committermetamuffin <metamuffin@disroot.org>2023-02-24 13:23:58 +0100
commit3ed98e04da0917e790063549676729c7051d67f7 (patch)
tree81fbb2c93172a7cbb284aaeed8c98d3f6a7c26b5 /src/error.rs
parentc0d504f9ae77f99e5484e92e2e9d3f68561129c5 (diff)
downloadgnix-3ed98e04da0917e790063549676729c7051d67f7.tar
gnix-3ed98e04da0917e790063549676729c7051d67f7.tar.bz2
gnix-3ed98e04da0917e790063549676729c7051d67f7.tar.zst
static file serving + bugs
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)
+ }
+}