Skip to content

Commit 2d091a3

Browse files
committed
i dont like this change, but i cant figure out how to bubble the error out otherwise
1 parent 2254661 commit 2d091a3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

crates/application/src/lib.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2806,7 +2806,21 @@ impl<RT: Runtime> Application<RT> {
28062806
)
28072807
.await;
28082808

2809-
Identity::user(identity_result?)
2809+
match identity_result {
2810+
Ok(user_identity) => Identity::user(user_identity),
2811+
Err(error) => {
2812+
// For authentication errors, store them in Identity::Unknown so that
2813+
// getUserIdentityDebug can access and log them instead of failing the
2814+
// request
2815+
if let Some(error_metadata) = error.downcast_ref::<ErrorMetadata>() {
2816+
if matches!(error_metadata.code, errors::ErrorCode::Unauthenticated) {
2817+
return Ok(Identity::Unknown(Some(error_metadata.clone())));
2818+
}
2819+
}
2820+
// For other errors (non-authentication), propagate them normally
2821+
return Err(error);
2822+
},
2823+
}
28102824
},
28112825
AuthenticationToken::PlaintextUser(token) => {
28122826
// For plaintext authentication, create a PlaintextUser identity

0 commit comments

Comments
 (0)