improved

Update in GraphQL API Error Handling

We're excited to introduce a significant update in how we handle errors in our GraphQL API! This change aims to enhance the development experience by providing a clearer and more consistent framework for dealing with error scenarios.

What Changed:

  1. Introduction of the "extensions" Key: Now, each error object in the "errors" array features an additional key called "extensions". This addition allows for including extra information about the error, beyond the basic data like "message", "locations", and "path".
  2. Standardization of the "code" Field: Within the "extensions" key, we've implemented the "code" field. This field provides a standardized error code for each type of error, making it easier to identify and handle encountered issues.
  3. New "correlation_id" Field: In addition to the error code, we've added the "correlation_id" field within "extensions". This unique correlation identifier aids in tracking and diagnosing problems.

Why It Matters:

  1. Clarity and Consistency: The new format offers a clearer and more consistent structure for error handling, making it easier for developers to understand and troubleshoot issues.
  2. Ease of Error Identification: With the standardization of the "code" field, developers can efficiently identify and handle different types of errors.
  3. Improved Tracking and Diagnostics: The "correlation_id" field provides a unique way to track and diagnose problems.

Old response:

{
 "data": {
   "deleteCard": null
 },
 "errors": [
   {
     "message": "Card not found with id: 00000000",
     "locations": [
       {
         "line": 32,
         "column": 3
       }
     ],
     "path": [
       "deleteCard"
     ],
     "code": 30003,
     "type": "ResourceNotFoundError"
   }
 ]
}

New response:

{
 "data": {
   "deleteCard": null
 },
 "errors": [
   {
     "message": "Card not found with id: 00000000",
     "locations": [
       {
         "line": 32,
         "column": 3
       }
     ],
     "path": [
       "deleteCard"
     ],
     "extensions": {
       "code": "RESOURCE_NOT_FOUND",
       "correlation_id": "fcc162735121ac9f71ceba9fb58a639e"
     }
   }
 ]
}

📘

See possible error codes in the documentation

We're confident that these enhancements will make the development experience with our GraphQL API even smoother and more efficient. If you have any questions or need further information on how to adapt to these changes, feel free to consult our updated documentation or reach out to our technical support team. We're here to assist you!