OXID eShop CE  6.1.5
OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler Class Reference

Public Member Functions

 __construct ($iDebug=0)
 
 __call ($sMethod, $aArgs)
 
 setIDebug ($iDebug)
 
 setLogFileName ($fileName)
 
 getLogFileName ()
 
 handleUncaughtException (\Throwable $exception)
 
 handleDatabaseException (\OxidEsales\Eshop\Core\Exception\DatabaseException $exception)
 
 writeExceptionToLog ($exception)
 
 displayOfflinePage ()
 
 getFormattedException ($exception)
 

Protected Member Functions

 displayDebugMessage ($exception, $logWritten=true)
 
 exitApplication ()
 

Protected Attributes

 $_sFileName
 
 $_iDebug = 0
 

Detailed Description

Exception handler, deals with all high level exceptions (caught in oxShopControl)

Constructor & Destructor Documentation

◆ __construct()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::__construct (   $iDebug = 0)

Class constructor

Parameters
integer$iDebugdebug level

Member Function Documentation

◆ __call()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::__call (   $sMethod,
  $aArgs 
)

Only used for convenience in UNIT tests by doing so we avoid writing extended classes for testing protected or private methods

Parameters
string$sMethodMethods name
array$aArgsArgument array
Exceptions
SystemComponentExceptionThrows an exception if the called method does not exist or is not accessible in current class
Returns
string

◆ displayDebugMessage()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::displayDebugMessage (   $exception,
  $logWritten = true 
)
protected

Print a debug message to the screen.

Parameters
\Throwable$exceptionThe exception to be treated
bool$logWrittenTrue, if an entry was written to the log file
Deprecated:
since v6.3 (2018-04-25); This method will be removed completely. Use an appropriate Monolog channel in the future.
Returns
null

◆ displayOfflinePage()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::displayOfflinePage ( )

Render an error message. If offline.html exists its content is displayed. Like this the error message is overridable within that file. Do not display an error message, if this file is included during a CLI command

Deprecated:
since v6.3 (2018-04-25); This method will be private. Use \oxTriggerOfflinePageDisplay() in the future.
Returns
null

◆ exitApplication()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::exitApplication ( )
protected

Exit the application with error status 1

◆ getFormattedException()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::getFormattedException (   $exception)

Return a formatted exception to be written to the log file.

Parameters
\Throwable$exception
Deprecated:
since v6.3 (2018-04-25); This method will be removed completely. Use an appropriate Monolog channel in the future.
Returns
string

◆ getLogFileName()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::getLogFileName ( )

Get log file path/name

Deprecated:
since v5.3 (2016-06-17); Logging mechanism will change in the future.
Returns
string

◆ handleDatabaseException()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::handleDatabaseException ( \OxidEsales\Eshop\Core\Exception\DatabaseException  $exception)

Report the exception and in case that iDebug is not set, redirect to maintenance page. Special methods are used here as the normal exception handling routines always need a database connection and this would create a loop.

Parameters
\OxidEsales\Eshop\Core\Exception\DatabaseException$exceptionException to handle

◆ handleUncaughtException()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::handleUncaughtException ( \Throwable  $exception)

Handler for uncaught exceptions. As this is the las resort no fancy business logic should be applied here.

Parameters
\Throwable$exceptionexception object
Exceptions

◆ setIDebug()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::setIDebug (   $iDebug)

Set the debug level

Parameters
int$iDebugdebug level (0== no debug)
Deprecated:
since v6.3 (2018-04-25); This method will be removed completely. Use an appropriate Monolog channel in the future.

◆ setLogFileName()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::setLogFileName (   $fileName)

Set log file name. The file will always be created in the same directory as OX_LOG_FILE

Deprecated:
since v5.3 (2016-06-17); Logging mechanism will change in the future.
Parameters
string$fileNamefile name

◆ writeExceptionToLog()

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::writeExceptionToLog (   $exception)

Write a formatted log entry to the log file.

Parameters
\Throwable$exception
Deprecated:
since v6.3 (2018-04-25); This method will be private. Use Registry::getLogger() to log error messages in the future.
Returns
bool

Member Data Documentation

◆ $_iDebug

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::$_iDebug = 0
protected

◆ $_sFileName

OxidEsales\EshopCommunity\Core\Exception\ExceptionHandler::$_sFileName
protected

The documentation for this class was generated from the following file: