modern-teal
modern-teal17mo ago

Dynamic Errors

How to handle dynamic errors in useForm
in onMutationError(error){ } the error conatins lot of data but i need only the message
No description
5 Replies
modern-teal
modern-teal17mo ago
want to access this error message
passive-yellow
passive-yellow17mo ago
Hey @rehan1, You can console your errorvariable for this.
modern-teal
modern-teal17mo 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
passive-yellow
passive-yellow17mo ago
The API you are using returns a response like this, there is nothing we can do about it. 🤗
modern-teal
modern-teal17mo ago
okay