Warning(Unhandled error in form submission) when validating a form with embedded resource
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.)
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"} , there will be a warning in the log:
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?

6 Replies
above is the form after AshPhoenix.Form.validate()
what does your validation look like?
From what I can see, you are adding an error of class Unknown. In your validation you can return a class like the others, InvalidAttribute etc...
https://hexdocs.pm/ash/error-handling.html#generating-errors
its returning either :ok or {:error, field: field, message: message}
Kind of strange which version of Ash are you running on? Maybe update?
I have setup a simple example, and my validation returns an Ash.Error.Changes.InvalidAttribute class. Not an unknown as yours.
I tried the latest ash version, same warning. In your example, is that both of the resources are embedded resources? do you mind if you show me the example? thanks.