public function handleUncaughtException(\Throwable $exception)
    {
        try {
            Registry::getLogger()->error(
                $exception->getMessage(),
                [$exception]
            );
        } catch (\Throwable $loggerException) {
            /**
             * Logger is broken because of exception.
             * Throw original exception in order to show the root cause of a problem.
             */
        }

        if ($this->_iDebug || defined('OXID_PHP_UNIT')) {
            throw $exception;
        } else {
            $this->displayOfflinePage();
            $this->exitApplication();
        }
    }