wispy-oliveW
Refine3y ago
7 replies
wispy-olive

We are trying to configure the way an error from the GraphQL resolver is handled in the refine.

We are sending the request using useCreate hook from refinedev/core and the Apollo Server is throwing an INTERNAL_SERVER_ERROR. Whenever Refine, receives this response, it automatically triggers a notification with the raw request in the body like the one here below.

Current Output

Duplicate barcode: {"response":{"errors":[{"message":"Duplicate barcode","locations":null,"path":null,"extensions":null}],"data":{"createProduct":null},"status":200,"headers":{"map":{"content-length":"122","content-type":"application/json; charset=utf-8"}}},"request":{"query":"mutation ($input: createProductInput) {\n createProduct (input: $input) {\n id, error, productName, status, barcode, brand, upc, image\n }\n}","variables":{"input":{"data":{"status":"active","productName":"Name","barcode":"177","brand":"some brand","upc":"upc"}}}}}

There was an error creating Product (status code: undefined)



Expected output should be something like

Error: Duplicate barcode

Any help would be very much appreciated here.
Was this page helpful?