summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-10-10 13:26:15 -0400
committerKit La Touche <kit@transneptune.net>2024-10-10 13:26:15 -0400
commit03f8d9ad603a4e523a0e2a0e60ad62c8725f0875 (patch)
treeb01543c0c2dadbd4be17320d47fc2e3d2fdb280d /src/error.rs
parentefae871b1bdb1e01081a44218281950cf0177f3b (diff)
parentd173bc08f2b699f58c8cca752ff688ad46f33ced (diff)
Merge branch 'main' into wip/path-routing-for-channels
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index 8792a1d..85573d4 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -69,3 +69,15 @@ impl IntoResponse for Unauthorized {
(StatusCode::UNAUTHORIZED, "unauthorized").into_response()
}
}
+
+pub struct NotFound<E>(pub E);
+
+impl<E> IntoResponse for NotFound<E>
+where
+ E: std::error::Error,
+{
+ fn into_response(self) -> Response {
+ let Self(response) = self;
+ (StatusCode::NOT_FOUND, response.to_string()).into_response()
+ }
+}