webauthn/src/Application/Model/Exceptions/WebauthnException.php

78 lines
1.8 KiB
PHP
Raw Normal View History

2022-11-03 13:18:02 +01:00
<?php
2022-11-04 22:02:44 +01:00
/**
2022-11-04 22:45:47 +01:00
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
2022-11-04 22:02:44 +01:00
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
2022-11-04 22:45:47 +01:00
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
2022-11-04 22:02:44 +01:00
*/
declare(strict_types=1);
2022-11-03 13:18:02 +01:00
namespace D3\Webauthn\Application\Model\Exceptions;
2022-12-05 23:45:12 +01:00
use D3\TestingTools\Production\IsMockable;
2022-11-03 13:18:02 +01:00
use D3\Webauthn\Application\Model\WebauthnErrors;
use Exception;
2022-11-03 13:18:02 +01:00
use OxidEsales\Eshop\Core\Exception\StandardException;
class WebauthnException extends StandardException
{
2022-12-05 23:45:12 +01:00
use IsMockable;
2022-11-03 13:18:02 +01:00
public $detailedErrorMessage = null;
public function __construct( $sMessage = "not set", $iCode = 0, Exception $previous = null )
2022-11-03 13:18:02 +01:00
{
$this->setDetailedErrorMessage($sMessage);
$this->d3CallMockableFunction(
[
StandardException::class,
'__construct'
],
2022-12-05 23:45:12 +01:00
[
$this->getErrorMessageTranslator()->translateError($sMessage, $this->getRequestType()),
$iCode,
$previous
]
2022-11-03 13:18:02 +01:00
);
}
2022-12-05 23:45:12 +01:00
/**
* @return WebauthnErrors
*/
protected function getErrorMessageTranslator(): WebauthnErrors
{
return oxNew(WebauthnErrors::class);
}
2022-11-03 13:18:02 +01:00
/**
* @return string|null
*/
public function getRequestType(): ?string
{
return null;
}
/**
* @return null|string
*/
public function getDetailedErrorMessage(): ?string
{
return $this->detailedErrorMessage;
}
/**
* @param string|null $detailedErrorMessage
*/
public function setDetailedErrorMessage(string $detailedErrorMessage = null): void
{
2022-11-04 00:12:42 +01:00
$this->detailedErrorMessage = 'Webauthn: '.$detailedErrorMessage;
2022-11-03 13:18:02 +01:00
}
}