src/Routes/Controller.php
public function resolveError(RequestApplicationInterface $app, \Throwable $exception, $asPlainText = false)
    {
        $app->view->context = $this;
        if ($asPlainText) {
            return $this->resolveErrorAsPlainText($app, $exception);
        }
        $format = $app->response->format;
        switch ($format) {
            case Response::FORMAT_RAW:
            case Response::FORMAT_HTML:
                return $this->resolveErrorAsHtml($app, $exception);
            default:
                return $this->resolveErrorAsArray($app, $exception);
        }
    }
public function resolveError(RequestApplicationInterface $app, \Throwable $exception, $asPlainText = false)
    {
        $app->view->context = $this;
        if ($asPlainText) {
            return $this->resolveErrorAsPlainText($app, $exception);
        }
        $format = $app->response->format;
        switch ($format) {
            case Response::FORMAT_RAW:
            case Response::FORMAT_HTML:
                return $this->resolveErrorAsHtml($app, $exception);
            default:
                return $this->resolveErrorAsArray($app, $exception);
        }
    }
Resolve error
@param RequestApplicationInterface $app
@param \Throwable                  $exception
@param bool                        $asPlainText
@return ExtendedPromiseInterface|ResponseBuilderInterface