factor out error_rows