Handle failed socket read more gracefully

There was an issue where you could get stuck in a loop trying to receive
data on a closed socket.
Gave the generator error its own class.