Generalize error handling for form.