Challenge - 5 Problems
GraphQL Error Format Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the output error message format for a GraphQL query with a syntax error?
Consider a GraphQL query with a missing closing brace. What does the error response look like?
GraphQL
query { user(id: 1) { name }Attempts:
2 left
💡 Hint
GraphQL errors include an 'errors' array with detailed message and location.
✗ Incorrect
GraphQL returns errors as an array under 'errors' with 'message' and 'locations' keys describing the problem.
❓ query_result
intermediate2:00remaining
What does a GraphQL error response contain when a requested field does not exist?
If a query asks for a field 'age' on a type that does not have it, what error response is returned?
GraphQL
query { user(id: 1) { age } }Attempts:
2 left
💡 Hint
GraphQL error messages specify the field and type causing the issue.
✗ Incorrect
GraphQL errors specify the exact field and type that caused the error with location info.
📝 Syntax
advanced2:30remaining
Which option correctly shows the GraphQL error format for a validation error with multiple errors?
A query has two errors: a missing field and a wrong argument type. What is the correct error response format?
GraphQL
query { user(id: "abc") { name age } }Attempts:
2 left
💡 Hint
GraphQL errors list each error with message and location in an array.
✗ Incorrect
GraphQL returns multiple errors as objects in the 'errors' array with detailed messages and locations.
🧠 Conceptual
advanced1:30remaining
What key fields are always present in a GraphQL error object?
Select the fields that are always included in each error object returned by a GraphQL server.
Attempts:
2 left
💡 Hint
Look for the standard keys used in GraphQL error objects.
✗ Incorrect
GraphQL error objects always include 'message' describing the error and 'locations' showing where it happened.
🔧 Debug
expert3:00remaining
Why does this GraphQL error response cause a client parsing failure?
Given this error response: {"errors":[{"message":"Field 'name' not found"}]} but the client expects 'locations' field as well, what is the issue?
Attempts:
2 left
💡 Hint
GraphQL clients expect a consistent error object structure.
✗ Incorrect
GraphQL error objects must include 'locations' to indicate where the error occurred; missing it can break clients expecting it.