From f905b1f375e91a93886363a9f97501943ae3b097 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Wed, 18 May 2022 17:11:00 +0200 Subject: [PATCH] Slightly more logging during authentication --- bffhd/capnp/authenticationsystem.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bffhd/capnp/authenticationsystem.rs b/bffhd/capnp/authenticationsystem.rs index bab6b65..563ab1b 100644 --- a/bffhd/capnp/authenticationsystem.rs +++ b/bffhd/capnp/authenticationsystem.rs @@ -65,12 +65,16 @@ impl AuthenticationSystem for Authentication { Ok(Step::Done(data)) => { self.state = State::Finished; - let uid = pry!(session.get_property::().ok_or(capnp::Error::failed( - "Authentication didn't provide an authid as required".to_string() - ))); - let session = pry!(manager.open(uid.as_ref()).ok_or(capnp::Error::failed( - "Failed to lookup the given user".to_string() - ))); + let uid = pry!(session.get_property::().ok_or_else(|| { + tracing::warn!("Authentication didn't provide an authid as required."); + capnp::Error::failed( + "Authentication didn't provide an authid as required".to_string(), + ) + })); + let session = pry!(manager.open(uid.as_ref()).ok_or_else(|| { + tracing::warn!(uid = uid.as_str(), "Failed to lookup the given user"); + capnp::Error::failed("Failed to lookup the given user".to_string()) + })); let mut builder = builder.init_successful(); if data.is_some() {