ModCfg/Application/Model/Exception/d3modprofile_exception.php

96 lignes
2.1 KiB
PHP
Brut Vue normale Historique

2024-04-19 16:15:46 +02:00
<?php
2024-09-02 08:48:43 +02:00
2024-04-19 16:15:46 +02:00
/**
2024-09-02 08:48:43 +02:00
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
2024-04-19 16:15:46 +02:00
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
2024-09-02 08:48:43 +02:00
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
2024-04-19 16:15:46 +02:00
*/
namespace D3\ModCfg\Application\Model\Exception;
2024-06-26 13:49:30 +02:00
use DateTimeImmutable;
2024-04-19 16:15:46 +02:00
use Exception;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Utils;
/**
* handle d3modprofile specific exceptions
*/
class d3modprofile_exception extends StandardException
{
private $_sModId;
protected $_sType;
/**
* @return string
*/
public function getString()
{
2024-06-26 13:49:30 +02:00
return self::class . " (time: " . (new DateTimeImmutable())->format('Y-m-d H:i:s')
. "): [{$this->code}]: {$this->message} - Faulty ModProfile: " . $this->getModCfgId();
2024-04-19 16:15:46 +02:00
//." \n Stack Trace: {$this->getTraceAsString()}\n\n";
}
public function debugOut()
{
//We are most likely are already dealing with an exception so making sure no other exceptions interfere
try {
$sLogMsg = $this->getString() . "\n Stack Trace: {$this->getTraceAsString(
)} \n---------------------------------------------\n";
$logger = Registry::getLogger();
$logger->error($sLogMsg);
} catch (Exception) {
}
}
/**
* @param $sModId
*/
public function setModCfgId($sModId)
{
$this->_sModId = $sModId;
}
/**
* @return string
*/
public function getModCfgId()
{
return $this->_sModId;
}
/**
* @param $sType
*/
public function setExcType($sType)
{
$this->_sType = $sType;
}
/**
* @return string
*/
public function getExcType()
{
return $this->_sType;
}
/**
* @return string
*/
public function getExcMessage()
{
return $this->message;
}
}