From 6131465d23d4e5a45416c87f9f60f2d5b33ffa59 Mon Sep 17 00:00:00 2001 From: strawberry Date: Tue, 16 Apr 2024 18:19:47 -0400 Subject: [PATCH] don't use bad_database (HTTP 500) for auth check failures this is not database-related, and may trigger exponential backoff against us from other servers Signed-off-by: strawberry --- src/service/rooms/event_handler/mod.rs | 5 ++++- src/service/rooms/timeline/mod.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/service/rooms/event_handler/mod.rs b/src/service/rooms/event_handler/mod.rs index d564aa06..56b9260e 100644 --- a/src/service/rooms/event_handler/mod.rs +++ b/src/service/rooms/event_handler/mod.rs @@ -494,7 +494,10 @@ impl Service { .map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed."))?; if !check_result { - return Err(Error::bad_database("Event has failed auth check with state at the event.")); + return Err(Error::BadRequest( + ErrorKind::InvalidParam, + "Event has failed auth check with state at the event.", + )); } debug!("Gathering auth events"); diff --git a/src/service/rooms/timeline/mod.rs b/src/service/rooms/timeline/mod.rs index 62d7ccf8..3639c56b 100644 --- a/src/service/rooms/timeline/mod.rs +++ b/src/service/rooms/timeline/mod.rs @@ -744,7 +744,7 @@ impl Service { ) .map_err(|e| { error!("Auth check failed: {:?}", e); - Error::bad_database("Auth check failed.") + Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed.") })?; if !auth_check {