format log messages in exception class

This commit is contained in:
Daniel Seifert 2022-11-04 00:12:42 +01:00
parent d41c3da290
commit 8aff5c8008
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
6 changed files with 7 additions and 7 deletions

View File

@ -72,7 +72,7 @@ class d3user_webauthn extends AdminDetailsController
$this->setAuthnRegister();
} catch (Exception|ContainerExceptionInterface|NotFoundExceptionInterface|DoctrineDriverException $e) {
Registry::getUtilsView()->addErrorToDisplay($e);
Registry::getLogger()->error('webauthn creation request: '.$e->getMessage(), ['UserId' => $this->getEditObjectId()]);
Registry::getLogger()->error($e->getMessage(), ['UserId' => $this->getEditObjectId()]);
Registry::getLogger()->debug($e->getTraceAsString());
Registry::getUtils()->redirect('index.php?cl=d3user_webauthn');
}

View File

@ -87,7 +87,7 @@ class d3webauthnadminlogin extends AdminController
} catch (WebauthnException $e) {
Registry::getSession()->setVariable(WebauthnConf::GLOBAL_SWITCH, true);
Registry::getUtilsView()->addErrorToDisplay($e);
Registry::getLogger()->error('webauthn request options: '.$e->getDetailedErrorMessage(), ['UserId' => $userId]);
Registry::getLogger()->error($e->getDetailedErrorMessage(), ['UserId' => $userId]);
Registry::getLogger()->debug($e->getTraceAsString());
$this->getUtils()->redirect('index.php?cl=login');
}
@ -122,7 +122,7 @@ class d3webauthnadminlogin extends AdminController
}
} catch (WebauthnException $e) {
Registry::getUtilsView()->addErrorToDisplay($e);
Registry::getLogger()->error('Webauthn: '.$e->getDetailedErrorMessage(), ['UserId' => $userId]);
Registry::getLogger()->error($e->getDetailedErrorMessage(), ['UserId' => $userId]);
Registry::getLogger()->debug($e->getTraceAsString());
$user->logout();
$this->getUtils()->redirect('index.php?cl=login');

View File

@ -78,7 +78,7 @@ class d3_account_webauthn extends AccountController
$this->setAuthnRegister();
$this->setPageType('requestnew');
} catch (WebauthnException $e) {
Registry::getLogger()->error('webauthn register: '.$e->getDetailedErrorMessage(), ['UserId: ' => $this->getUser()->getId()]);
Registry::getLogger()->error($e->getDetailedErrorMessage(), ['UserId: ' => $this->getUser()->getId()]);
Registry::getLogger()->debug($e->getTraceAsString());
Registry::getUtilsView()->addErrorToDisplay($e);
}

View File

@ -87,7 +87,7 @@ class d3webauthnlogin extends FrontendController
$this->addTplParam('webauthn_publickey_login', $publicKeyCredentialRequestOptions);
} catch (WebauthnException $e) {
Registry::getSession()->setVariable(WebauthnConf::GLOBAL_SWITCH, true);
Registry::getLogger()->error('webauthn request options: '.$e->getDetailedErrorMessage(), ['UserId' => $userId]);
Registry::getLogger()->error($e->getDetailedErrorMessage(), ['UserId' => $userId]);
Registry::getLogger()->debug($e->getTraceAsString());
Registry::getUtilsView()->addErrorToDisplay($e);
$this->getUtils()->redirect('index.php?cl=start');

View File

@ -43,6 +43,6 @@ class WebauthnException extends StandardException
*/
public function setDetailedErrorMessage(string $detailedErrorMessage = null): void
{
$this->detailedErrorMessage = $detailedErrorMessage;
$this->detailedErrorMessage = 'Webauthn: '.$detailedErrorMessage;
}
}

View File

@ -199,7 +199,7 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
} catch (WebauthnException $e) {
Registry::getUtilsView()->addErrorToDisplay($e);
Registry::getLogger()->error(
'Webauthn: '.$e->getDetailedErrorMessage(),
$e->getDetailedErrorMessage(),
['UserId' => Registry::getSession()->getVariable(WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER)]
);
Registry::getLogger()->debug($e->getTraceAsString());