# Error Handling for Custom Dynamic Fields in Registration Form (Authn MFE)

**URL:** <https://discuss.openedx.org/t/error-handling-for-custom-dynamic-fields-in-registration-form-authn-mfe/13453>\
**Category:** Development\
**Tags:** mfe, olive\
**Created:** [July 19, 2024, 8:12am UTC](https://discuss.openedx.org/t/error-handling-for-custom-dynamic-fields-in-registration-form-authn-mfe/13453 "2024-07-19T08:12:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harout7](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/harout7/32/5369_2.png) [@harout7](https://discuss.openedx.org/u/harout7)\
**Post date:** [July 19, 2024, 8:12am UTC](https://discuss.openedx.org/t/error-handling-for-custom-dynamic-fields-in-registration-form-authn-mfe/13453/1 "2024-07-19T08:12:50Z")

</div>

Hello,

I am currently working on customizing the registration page on the Open edX platform (olive release) to include dynamic fields (extended profile fields) added through a custom Django app. While the backend integration works fine, I’m encountering issues with the error handling of these dynamic fields in the React frontend (Authn MFE)

The default fields (like email and username) correctly show validation errors, but for the custom dynamic fields, rather than showing specific validation errors, the system displays a generic error message:

> An Unexpected Error Occurred. Please Click The Button Below To Refresh The Page

Checking the error in console:

> Objects are not valid as a React child (found: object with keys {required}). If you meant to render a collection of children, use an array instead.

This suggests a problem with how React in the Authn MFE is handling the error objects sent from the backend.

**Does Open edX’s Authn MFE have built-in support for handling custom dynamic field errors, or do I need to modify the MFE code to handle these errors?**

---

<div class="post-metadata">

**Author:** ![vivek](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/vivek/32/6825_2.png) [@vivek](https://discuss.openedx.org/u/vivek)\
**Post date:** [July 19, 2024, 10:31am UTC](https://discuss.openedx.org/t/error-handling-for-custom-dynamic-fields-in-registration-form-authn-mfe/13453/2 "2024-07-19T10:31:58Z")

</div>

hi @harout7 ,  
may be you trying to render Objects in error , if you are using django form validation and sending dict intead of error message

---

<div class="post-metadata">

**Author:** ![harout7](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/harout7/32/5369_2.png) [@harout7](https://discuss.openedx.org/u/harout7)\
**Post date:** [July 19, 2024, 10:33am UTC](https://discuss.openedx.org/t/error-handling-for-custom-dynamic-fields-in-registration-form-authn-mfe/13453/3 "2024-07-19T10:33:29Z")

</div>

Yes that’s what is happening I have used form validation in django forms which has dictionary structure and when the error message sent to react it couldn’t render it, any idea how to fix it ?

---

<div class="post-metadata">

**Author:** ![vivek](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/vivek/32/6825_2.png) [@vivek](https://discuss.openedx.org/u/vivek)\
**Post date:** [July 19, 2024, 11:05am UTC](https://discuss.openedx.org/t/error-handling-for-custom-dynamic-fields-in-registration-form-authn-mfe/13453/4 "2024-07-19T11:05:48Z")

</div>

@harout7 ,  
try like this  
from django.core.exceptions import ValidationError  
and raise error like this instead of making dict  
raise ValidationError(‘Email must be from the [example.com](http://example.com) domain.’)
