Catch errors from the socket