summaryrefslogtreecommitdiff
path: root/src/channel/routes.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-09 22:52:42 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-09 23:49:40 -0400
commite55565cb3841bf17cf7b8a5e5cf84e59e4372e11 (patch)
tree31fdbf7d8fbd6b1783c599347642592e4b44ea13 /src/channel/routes.rs
parent66c99389e4725d96ef68298a9c608654b9517d4b (diff)
Normalize `not found` errors a bit.
Diffstat (limited to 'src/channel/routes.rs')
-rw-r--r--src/channel/routes.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/channel/routes.rs b/src/channel/routes.rs
index a92615f..e97c447 100644
--- a/src/channel/routes.rs
+++ b/src/channel/routes.rs
@@ -7,7 +7,13 @@ use axum::{
};
use super::{app, Channel, Id};
-use crate::{app::App, clock::RequestedAt, error::Internal, login::Login, message::app::SendError};
+use crate::{
+ app::App,
+ clock::RequestedAt,
+ error::{Internal, NotFound},
+ login::Login,
+ message::app::SendError,
+};
#[cfg(test)]
mod test;
@@ -81,9 +87,7 @@ impl IntoResponse for SendErrorResponse {
fn into_response(self) -> Response {
let Self(error) = self;
match error {
- not_found @ SendError::ChannelNotFound(_) => {
- (StatusCode::NOT_FOUND, not_found.to_string()).into_response()
- }
+ not_found @ SendError::ChannelNotFound(_) => NotFound(not_found).into_response(),
other => Internal::from(other).into_response(),
}
}