refactor(socket) add condition on cd error