catch error of socket