Add client-side error handling and escape attributes in templates when possible