Challenge - 5 Problems
GraphQL Error Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Identify the error type from GraphQL query
What error type will this GraphQL query produce when executed if the field
age does not exist in the schema?GraphQL
query {
user(id: "123") {
name
age
}
}Attempts:
2 left
💡 Hint
Think about errors caused by requesting fields not defined in the schema.
✗ Incorrect
Requesting a field not defined in the schema causes a ValidationError because the query does not match the schema's structure.
❓ Predict Output
intermediate2:00remaining
Determine the error from a malformed GraphQL query
What error will this GraphQL query produce due to incorrect syntax?
GraphQL
query {
user(id: "123") {
name
email
}Attempts:
2 left
💡 Hint
Look for missing or extra braces or parentheses.
✗ Incorrect
The query is missing a closing brace, causing a SyntaxError during parsing.
❓ Predict Output
advanced2:00remaining
Identify the error when a resolver throws an exception
What error type will be returned if a resolver function throws an exception during query execution?
GraphQL
query {
user(id: "123") {
name
posts {
title
}
}
}Attempts:
2 left
💡 Hint
Consider errors that happen while fetching data, not parsing or validating.
✗ Incorrect
ExecutionError occurs when the server fails to resolve a field during query execution due to exceptions.
❓ Predict Output
advanced2:00remaining
Classify the error caused by unauthorized access
What error will be returned if a user tries to access a field they do not have permission to see?
GraphQL
query {
secretData {
confidentialInfo
}
}Attempts:
2 left
💡 Hint
Think about errors related to permission checks after authentication.
✗ Incorrect
AuthorizationError occurs when a user is authenticated but lacks permission to access certain data.
🧠 Conceptual
expert3:00remaining
Distinguish error types in GraphQL lifecycle
Match each error type to the correct phase in the GraphQL request lifecycle where it typically occurs.
Attempts:
2 left
💡 Hint
Recall the order: parsing, validating, executing, then checking permissions.
✗ Incorrect
SyntaxError happens during parsing, ValidationError during schema validation, ExecutionError during data fetching, and AuthorizationError during permission checks.