handle errors upon deletion in a uniform way