chore: send rest of the errors to the catchers

This commit is contained in:
Zomatree
2025-07-02 01:16:16 +01:00
parent cf4fe859bf
commit 46e127ccd2
8 changed files with 27 additions and 3 deletions

View File

@@ -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))
}
}

View File

@@ -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)));
}