grumpy-cyan
grumpy-cyan•2y 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
grumpy-cyan
grumpy-cyan•2y ago
want to access this error message
harsh-harlequin
harsh-harlequin•2y ago
Hey @rehan1, You can console your errorvariable for this.
grumpy-cyan
grumpy-cyan•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
harsh-harlequin
harsh-harlequin•2y ago
The API you are using returns a response like this, there is nothing we can do about it. 🤗
grumpy-cyan
grumpy-cyan•2y ago
okay