0
0
GraphQLquery~10 mins

GraphQL error format - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the standard field for error messages in a GraphQL error response.

GraphQL
{ "errors": [ { "[1]": "Field 'name' is missing" } ] }
Drag options to blanks, or click blank then click option'
Amsg
Berror
Cmessage
Ddetail
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'error' or 'msg' instead of 'message' causes the error format to be invalid.
2fill in blank
medium

Complete the code to include the location of the error in the GraphQL error response.

GraphQL
{ "errors": [ { "message": "Invalid query", "[1]": [ { "line": 2, "column": 3 } ] } ] }
Drag options to blanks, or click blank then click option'
Alocations
Bposition
Cplace
Dcoords
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'position' or 'coords' instead of 'locations' breaks the standard format.
3fill in blank
hard

Fix the error in the GraphQL error response by completing the missing field for the error path.

GraphQL
{ "errors": [ { "message": "Cannot query field 'age'", "locations": [ { "line": 3, "column": 5 } ], "[1]": [ "user", "age" ] } ] }
Drag options to blanks, or click blank then click option'
Atrace
Broute
Clocation
Dpath
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'location' or 'trace' instead of 'path' causes the error format to be incorrect.
4fill in blank
hard

Fill both blanks to add an extensions object with a code and a timestamp to the GraphQL error.

GraphQL
{ "errors": [ { "message": "Unauthorized", "extensions": { "[1]": "UNAUTHENTICATED", "[2]": "2024-06-01T12:00:00Z" } } ] }
Drag options to blanks, or click blank then click option'
Acode
Berror
Ctimestamp
Dtime
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'error' or 'time' instead of 'code' or 'timestamp' breaks the standard.
5fill in blank
hard

Fill all three blanks to create a full GraphQL error with message, locations, and path fields.

GraphQL
{ "errors": [ { "[1]": "Field 'email' not found", "[2]": [ { "line": 4, "column": 7 } ], "[3]": [ "user", "email" ] } ] }
Drag options to blanks, or click blank then click option'
Amessage
Blocations
Cpath
Derror
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'error' instead of 'message' or mixing up 'locations' and 'path' fields.