public function handleException($exception)
{
// Ignore if the error is suppressed by using the shut-up operator @
if (error_reporting() === 0) {
return;
}
$this->renderingOptions = $this->resolveCustomRenderingOptions($exception);
if (is_object($this->systemLogger) && isset($this->renderingOptions['logException']) && $this->renderingOptions['logException']) {
if ($exception instanceof \Throwable) {
if ($this->systemLogger instanceof ThrowableLoggerInterface) {
$this->systemLogger->logThrowable($exception);
} else {
// Convert \Throwable to \Exception for non-supporting logger implementations
$this->systemLogger->logException(new \Exception($exception->getMessage(), $exception->getCode()));
}
} elseif ($exception instanceof \Exception) {
$this->systemLogger->logException($exception);
}
}
switch (PHP_SAPI) {
case 'cli':
$this->echoExceptionCli($exception);
break;
default:
$this->echoExceptionWeb($exception);
}
}