Handle IOError as well as WS errors