public function dispatch(Request $request)
    {
        $this->currentRoute = null;

        $this->container->instance(Request::class, $request);

        $this->routesDispatched++;

        try {
            $response = $this->adapter->dispatch($request, $request->version());
        } catch (Exception $exception) {
            if ($request instanceof InternalRequest) {
                throw $exception;
            }

            $this->exception->report($exception);

            $response = $this->exception->handle($exception);
        }

        return $this->prepareResponse($response, $request, $request->format());
    }