factor out error actions