         :ok = Receiver.read(s.receiver, from, command, opts)
         {:noreply, s}
 
-      {:error, _reason} = error ->
-        {:disconnect, error, error, s}
+      {:error, reason} = error ->
+        {:disconnect, error, error_response(s, reason), s}
     end
   end
 

        :ok = Receiver.read_quiet(s.receiver, from, Enum.reverse([{i, :NOOP, [], []} | commands]))
        {:noreply, s}

      {:error, _reason} = error ->
        {:disconnect, error, error, s}
    end
  end



    if receiver_queue do
      Enum.each(receiver_queue, fn from ->
        Connection.reply(from, error_response(s))
      end)
    end

    :ok
  end

  defp error_response(%State{server: server}, reason \\ :closed) do
    {{:error, reason}, %{server: server}}
  end

  defp maybe_activate_sock(state) do
