Is there any public function to prettify a BulkResult/Change error?
I want to display a
:string
error message but in this case there is none, i think AshJsonApi translates this errors to a message somehow, is that function public?
Solution:Jump to solution
so like
AshJsonApi.Error.to_json_api_errors(Domain, Resource, error, :create)
6 Replies
Youu can pass the errors into that to get normalized errors back
do i need the resource struct or the Module is enough?
Because since this is a bulk create i dont have any resource, but with the code above i get this error:
You should pass in the
.errors
and the resource is the module
not an instanceSolution
so like
AshJsonApi.Error.to_json_api_errors(Domain, Resource, error, :create)
you may need to loop over the errors...not sure
you will have to experiment
that was the issue, just needed
.errors
thank you 🙌