Dynamic Errors
How to handle dynamic errors in useForm
in onMutationError(error){ } the error conatins lot of data but i need only the message
in onMutationError(error){ } the error conatins lot of data but i need only the message
![No description](https://cdn.answeroverflow.com/1065512763746684960/Screenshot_46.png)
5 Replies
fair-rose•2y ago
want to access this error message
correct-apricot•2y ago
Hey @rehan1,
You can console your
error
variable for this.fair-rose•2y ago
Uniqueness violation. duplicate key value violates unique constraint "org_specialities_organization_id_speciality_id_key": {"response":{"errors":[{"extensions":{"code":"constraint-violation","path":"$.selectionSet.insert_org_specialities_one.args.object"},"message":"Uniqueness violation. duplicate key value violates unique constraint "org_specialities_organization_id_speciality_id_key""}],"status":200,"headers":{"map":{"content-type":"application/json; charset=utf-8"}}},"request":{"query":"mutation ($object: org_specialities_insert_input!) {\n insert_org_specialities_one (object: $object) {\n id, speciality_id\n }\n}","variables":{"object":{"speciality_id":"a92e472a-4d69-4bd0-930a-3df6cb418b7f"}}}}
it shows this way
what i need is only the message dont need rest of that data
correct-apricot•2y ago
The API you are using returns a response like this, there is nothing we can do about it. 🤗
fair-rose•2y ago
okay