Add per-item retry count and error classes

@tleach