From 82ab8b6f922ea2f952efcba7d391656af232b9e2 Mon Sep 17 00:00:00 2001 From: Olli Huopio Date: Thu, 7 Mar 2024 15:04:44 +0200 Subject: [PATCH] Change from eager to lazy evaluation on error branch. Otherwise confusing error logging appears --- .../authentication_builtin/authentication.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/security/authentication/authentication_builtin/authentication.rs b/src/security/authentication/authentication_builtin/authentication.rs index 9094980c..896e9f8d 100644 --- a/src/security/authentication/authentication_builtin/authentication.rs +++ b/src/security/authentication/authentication_builtin/authentication.rs @@ -175,15 +175,13 @@ impl Authentication for AuthenticationBuiltin { // let certificate_algorithm = identity_certificate .key_algorithm() - .ok_or(create_security_error!( - "Identity Certificate specifies no public key algorithm" - )) + .ok_or_else(|| { + create_security_error!("Identity Certificate specifies no public key algorithm") + }) .and_then(CertificateAlgorithm::try_from)?; let ca_algorithm = identity_ca .key_algorithm() - .ok_or(create_security_error!( - "CA Certificate specifies no public key algorithm" - )) + .ok_or_else(|| create_security_error!("CA Certificate specifies no public key algorithm")) .and_then(CertificateAlgorithm::try_from)?; let identity_token = BuiltinIdentityToken {