raise connection errors in socket space

I suggest this change to avoid uncaught exception to raise at process level.