Warning(Unhandled error in form submission) when validating a form with embedded resource
Ash
I have created two embedded resources (membership_purchase and member_purchase_info). They are embedded resources just for being used in a form so I can have validations more easily. Membership_purchase can have multiple member_purchase_info. (For details, please see attachments.)
attribute :member_purchase_infos, {:array, Marge.AshDomains.Members.MemberPurchaseInfo}, allow_nil?: false, public?: true end
attribute :member_purchase_infos, {:array, Marge.AshDomains.Members.MemberPurchaseInfo}, allow_nil?: false, public?: true end
Everything works fine. All validations work fine and validation messages are displayed correctly in the UI. But whenever the Marge.AshDomains.Members.Validations.ValidateAge is not passed and returning an error e.g.
{:error, field: :dob, message: "Age cannot be less than 18"}
{:error, field: :dob, message: "Age cannot be less than 18"}
, there will be a warning in the log:
[warning] Unhandled error in form submission for Marge.AshDomains.Members.MembershipPurchase.createThis error was unhandled because Ash.Error.Unknown.UnknownError does not implement the `AshPhoenix.FormData.Error` protocol.** (Ash.Error.Unknown.UnknownError) Bread Crumbs:> Exception raised in bulk create: Marge.AshDomains.Members.MemberPurchaseInfo.createAge cannot be less than 18
[warning] Unhandled error in form submission for Marge.AshDomains.Members.MembershipPurchase.createThis error was unhandled because Ash.Error.Unknown.UnknownError does not implement the `AshPhoenix.FormData.Error` protocol.** (Ash.Error.Unknown.UnknownError) Bread Crumbs:> Exception raised in bulk create: Marge.AshDomains.Members.MemberPurchaseInfo.createAge cannot be less than 18
The form and flow are working fine, as I am not really creating anything in the database. I just use it as a form to get data from user and then process it in the next step. So my question is how I can suppress this warning?
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.