Handling other not caught exceptions.

@param \OxidEsales\Eshop\Core\Exception\StandardException $exception
487917
protected function _handleBaseException($exception)
    {
        $this->logException($exception);

        if ($this->_isDebugMode()) {
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($exception);
            $this->_process('exceptionError', 'displayExceptionError');
        }
    }
902851
public function handle($exception)
    {
        $exception = call_user_func($this->config('exceptionCallback'), $exception);
        if (!$exception) {
            return;
        }
        $client = $this->client();
        $client = call_user_func($this->config('clientCallback'), $client);
        if ($client) {
            $client->addError(sprintf('%s: %s', get_class($exception), $exception->getMessage()));
        }
    }
385355
protected function throwError($exception)
    {
        switch ($exception->getResponse()->getStatusCode()) {
            case 400:
                throw new BadRequestException($exception);
                break;

            case 401:
                throw new UnauthorizedException($exception);
                break;

            case 403:
                throw new MethodNotAllowedException($exception);
                break;

            case 404:
                throw new NotFoundException($exception);
                break;

            default:
                throw new Exception($exception);
                break;
        }
    }
1124940
protected function logException(\Exception $exception)
    {
        /** The exception has to be converted into an instance of oxException in order to be logged like this */
        $exception = $this->convertException($exception);
        \OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]);
    }
945758
protected function error(\Throwable $exception)
    {
        if ($this->errorHandler === null) {
            throw $exception;
        }

        ($this->errorHandler)($exception);
    }
186956
public function handleException($exception)
  {
    // Disable error capturing to avoid recursive errors while handling exceptions.
    $this->unregister();

    try
    {
      $this->clearOutput();
      $this->renderException($exception);

      exit(-1);
    }
    catch (\Exception $e)
    {
      // Another exception could be thrown while displaying the exception.
      $message = "An Error occurred while handling another error:\n";
      $message .= (string)$e;
      $message .= "\nPrevious exception:\n";
      $message .= (string)$exception;
      if ($this->myDebug)
      {
        $this->echoMessage($message);
      }
      else
      {
        $this->echoMessage('An internal server error occurred.');
      }
      $message .= "\n\$_SERVER = ".print_r($_SERVER, true);
      error_log($message);

      exit(1);
    }
  }
205066
public function handleException($exception)
    {
        // Walk the registered handlers in the reverse order
        // they were registered, and pass off the exception
        $inspector = $this->getInspector($exception);

        // Capture output produced while handling the exception,
        // we might want to send it straight away to the client,
        // or return it silently.
        $this->system->startOutputBuffering();

        // Just in case there are no handlers:
        $handlerResponse = null;
        $handlerContentType = null;

        foreach (array_reverse($this->handlerStack) as $handler) {
            $handler->setRun($this);
            $handler->setInspector($inspector);
            $handler->setException($exception);

            // The HandlerInterface does not require an Exception passed to handle()
            // and neither of our bundled handlers use it.
            // However, 3rd party handlers may have already relied on this parameter,
            // and removing it would be possibly breaking for users.
            $handlerResponse = $handler->handle($exception);

            // Collect the content type for possible sending in the headers.
            $handlerContentType = method_exists($handler, 'contentType') ? $handler->contentType() : null;

            if (in_array($handlerResponse, [Handler::LAST_HANDLER, Handler::QUIT])) {
                // The Handler has handled the exception in some way, and
                // wishes to quit execution (Handler::QUIT), or skip any
                // other handlers (Handler::LAST_HANDLER). If $this->allowQuit
                // is false, Handler::QUIT behaves like Handler::LAST_HANDLER
                break;
            }
        }

        $willQuit = $handlerResponse == Handler::QUIT && $this->allowQuit();

        $output = $this->system->cleanOutputBuffer();

        // If we're allowed to, send output generated by handlers directly
        // to the output, otherwise, and if the script doesn't quit, return
        // it so that it may be used by the caller
        if ($this->writeToOutput()) {
            // @todo Might be able to clean this up a bit better
            if ($willQuit) {
                // Cleanup all other output buffers before sending our output:
                while ($this->system->getOutputBufferLevel() > 0) {
                    $this->system->endOutputBuffering();
                }

                // Send any headers if needed:
                if (Misc::canSendHeaders() && $handlerContentType) {
                    header("Content-Type: {$handlerContentType}");
                }
            }

            $this->writeToOutputNow($output);
        }

        if ($willQuit) {
            // HHVM fix for https://github.com/facebook/hhvm/issues/4055
            $this->system->flushOutputBuffer();

            $this->system->stopExecution(1);
        }

        return $output;
    }
183013
private function logException(Exception $exception): void
    {
        if ($exception instanceof HttpExceptionInterface && $exception->getStatusCode() < 500) {
            return;
        }

        $this->logger->critical(
            sprintf(
                'Uncaught PHP Exception %s: "%s" at %s line %s',
                get_class($exception),
                $exception->getMessage(),
                $exception->getFile(),
                $exception->getLine()
            ),
            ['exception' => $exception]
        );
    }
807687
public function handleException(Exception $exception)
    {
        $this->_sendFatalError("Fatal proxy Exception: '"
                               . $exception->getMessage()
                               . "' in "
                               . $exception->getFile()
                               . ":"
                               . $exception->getLine());
    }
724181
public function handleExceptions($exception)
    {
        $this->displayError($exception);
        $this->sendErrorNotification($exception);

        if(isset($this->ApplicationContext) && ($this->ApplicationContext->isOneOffRedeploy() || $this->redeployOnError))
            $this->ApplicationContext->clearContextFiles();
    }
1182574
public function handleException(Exception $exception)
    {
        $severity = method_exists($exception, 'getSeverity') ? $exception->getSeverity() : self::ERROR_LEVEL;
        self::singleton()
            ->log(
                $severity,
                $exception->getMessage(),
                [
                    self::CONTEXT_EXCEPTION => get_class($exception),
                    self::CONTEXT_ERROR_FILE => $exception->getFile(),
                    self::CONTEXT_ERROR_LINE => $exception->getLine(),
                    self::CONTEXT_TRACE => $exception->getTrace()
                ]
            );
    }
190849
public function handleException(\Exception $exception) {
    // get error level
    $logFunction = 'error';
    if ($exception instanceof ApplicationException) {
      $logFunction = $exception->getError()->getLevel() == ApplicationError::LEVEL_WARNING ?
              'warn' : 'error';
    }
    self::$logger->$logFunction($exception);

    try {
      if (ObjectFactory::getInstance('configuration') != null) {
        // rollback current transaction
        $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
        $persistenceFacade->getTransaction()->rollback();

        // redirect to failure action
        if ($this->request) {
          $error = ApplicationError::fromException($exception);
          $this->request->addError($error);
          $this->response->addError($error);
          $this->request->setAction('failure');
          $this->response->setAction('failure');
          $this->response->setStatus($error->getStatusCode());
          ObjectFactory::getInstance('actionMapper')->processAction($this->request, $this->response);
          return;
        }
      }
      throw $exception;
    }
    catch (\Exception $ex) {
      self::$logger->error($ex->getMessage()."\n".$ex->getTraceAsString());
    }
  }
913559
public function exceptionHandler($exception)
    {
        // Standard PHP Libraries Error
        if ($exception instanceof \Error) {
            $error = new ErrorException(
                $exception->getMessage(),
                $exception->getCode(),
                $exception->getFile(),
                $exception->getLine()
            );

            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString(language()->getLine('E_CAUGHT_ERROR'))
                    ->setNewLinesAfter(1)
            );

            output()->write(
                (new Format())
                    ->setContextualClass(Format::WARNING)
                    ->setString('[ ' . language()->getLine($error->getStringSeverity()) . ' ] ' . $error->getMessage())
                    ->setNewLinesAfter(1)
            );

            output()->write(
                (new Format())
                    ->setContextualClass(Format::INFO)
                    ->setString($error->getFile() . ':' . $error->getLine())
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_ERROR);
        } elseif ($exception instanceof AbstractException) {

            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString(language()->getLine($exception->getHeader()))
                    ->setNewLinesAfter(1)
            );

            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString('[ ' . language()->getLine($exception->getCode()) . ' ] ' . language()->getLine($exception->getDescription()))
                    ->setNewLinesAfter(1)
            );

            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString($exception->getMessage())
                    ->setNewLinesAfter(1)
            );

            output()->write(
                (new Format())
                    ->setString($debugTitle = language()->getLine('E_DEBUG_BACKTRACE') . ':')
                    ->setContextualClass(Format::INFO)
                    ->setNewLinesBefore(1)
                    ->setNewLinesAfter(1)
            );

            output()->write((new Line(strlen($debugTitle) * 2))
                ->setContextualClass(Line::INFO)
                ->setNewLinesAfter(2));

            $table = new Table();
            $table->isShowBorder = false;

            $i = 1;
            foreach ($exception->getChronology() as $chronology) {
                $table
                    ->addRow()
                    ->addColumn($i . '. ' . $chronology->call)
                    ->addRow()
                    ->addColumn($chronology->file . ':' . $chronology->line)
                    ->addRow()
                    ->addColumn('');

                $i++;
            }

            output()->write(
                (new Format())
                    ->setContextualClass(Format::INFO)
                    ->setString($table->render())
                    ->setNewLinesAfter(2)
            );
        } // Standard PHP Libraries Exception
        elseif ($exception instanceof \Exception) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString('[ ' . language()->getLine($exception->getCode()) . ' ] ' . language()->getLine($exception->getMessage()))
                    ->setNewLinesAfter(1)
            );

            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString($exception->getMessage())
                    ->setNewLinesAfter(1)
            );

            output()->write(
                (new Format())
                    ->setString($debugTitle = language()->getLine('E_DEBUG_BACKTRACE') . ':')
                    ->setContextualClass(Format::INFO)
                    ->setNewLinesBefore(1)
                    ->setNewLinesAfter(1)
            );

            output()->write((new Line(strlen($debugTitle) * 2))
                ->setContextualClass(Line::INFO)
                ->setNewLinesAfter(2));

            $table = new Table();
            $table->isShowBorder = false;

            $trace = new Trace($exception->getTrace());

            $i = 1;
            foreach ($trace->getChronology() as $chronology) {
                $table
                    ->addRow()
                    ->addColumn($i . '. ' . $chronology->call)
                    ->addRow()
                    ->addColumn($chronology->file . ':' . $chronology->line)
                    ->addRow()
                    ->addColumn('');

                $i++;
            }

            output()->write(
                (new Format())
                    ->setContextualClass(Format::INFO)
                    ->setString($table->render())
                    ->setNewLinesAfter(2)
            );
        }
    }
557364
public function exceptionHandler($exception)
    {
        $context = array(
            'file'    => $exception->getFile(),
            'line'    => $exception->getLine()
        );

        if ($this->reportBacktrace) {
            $context['backtrace'] = $this->getBacktraceReporter()->getBacktrace($exception);
        }

        if ($this->exceptionInContext) {
            $context['exception'] = $exception;
        }

        $this->logger->error(
            $message = 'Uncaught ' . get_class($exception) . ': ' . $exception->getMessage(),
            $context
        );

        // Exceptions must be reported in general because they stop the regular display of the page
        if ($this->showErrors || $this->getEnvReporter()->isLive()) {
            $this->getErrorReporter()->reportError($exception);
        }
    }
1168309
public function exception($exception)
    {
        try {
            foreach ($this->handlers as $handler) {
                $handler($exception);
            }
        } catch (\Throwable $e) {
            $msg = "Infinity loop in exception & error handler. \nMessage:\n" . $e;

            if ($this->app->get('system.debug')) {
                exit($msg);
            }

            exit($e->getMessage());
        }

        exit();
    }
1189793
public function handleException(ServerRequestInterface $request, ResponseInterface $response, Exception $exception)
    {
        return $this->withError($response, $exception);
    }
725889
public static function exception($exception): void
    {
        self::getInstance()->error(
            $exception->getMessage() . ' [' .
            $exception->getFile() . ':' .
            $exception->getLine() . ']'
        );
    }