Add a rescue for socket errors