       {:ok, frame, state}
     else
       {:error, reason} ->
-        {:disconnect, reason, state}
+        {:disconnect, Error.exception(action: "execute", reason: reason), state}
     end
   end
 

      |> Protocol.encode_request(query)
      |> Frame.encode()

    case :gen_tcp.send(sock, payload) do
      :ok ->
        {:ok, %Frame{} = frame} = Utils.recv_frame(sock)
        {:ok, Protocol.decode_response(frame, query), state}
      {:error, reason} ->
        {:disconnect, reason, state}
    end
  end


  def connect(opts) do
    host = Keyword.fetch!(opts, :host) |> to_char_list()
    port = Keyword.get(opts, :port, 9042)

    with {:ok, sock} <- connect(host, port),
         {:ok, options} <- Utils.request_options(sock),
         :ok <- Utils.startup_connection(sock, options),
         do: {:ok, %{sock: sock}}
  end

  def checkout(state) do
