chore: send rest of the errors to the catchers

This commit is contained in:
Zomatree
2025-08-15 02:07:25 +01:00
parent cf4fe859bf
commit 46e127ccd2
8 changed files with 27 additions and 3 deletions
@@ -38,6 +38,7 @@ impl<'r> FromRequest<'r> for User {
if let Some(user) = user {
Outcome::Success(user.clone())
} else {
request.local_cache(|| Some(create_error!(DuplicateNonce)));
Outcome::Error((Status::Unauthorized, authifier::Error::InvalidSession))
}
}
@@ -113,6 +113,8 @@ impl<'r> FromRequest<'r> for IdempotencyKey {
let idempotency = IdempotencyKey { key };
let mut cache = TOKEN_CACHE.lock().await;
if cache.get(&idempotency.key).is_some() {
request.local_cache(|| Some(create_error!(DuplicateNonce)));
return Outcome::Error((Status::Conflict, create_error!(DuplicateNonce)));
}