0
0
GraphQLquery~20 mins

Field-level errors in GraphQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Field-level Error Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
Identify the field-level error in this GraphQL query response

Given this GraphQL query response, which field contains an error?

{
  "data": {
    "user": {
      "id": "123",
      "email": null,
      "name": "Alice"
    }
  },
  "errors": [
    {
      "message": "Email not found",
      "path": ["user", "email"]
    }
  ]
}
AThere are no field-level errors in this response
BThe 'id' field has an error because it is missing
CThe 'email' field has an error because it is null and reported in errors
DThe 'name' field has an error because it is a string
Attempts:
2 left
💡 Hint

Look at the 'errors' array and see which field path it points to.

🧠 Conceptual
intermediate
1:30remaining
Understanding field-level errors in GraphQL

What does a field-level error in a GraphQL response mean?

AOnly a specific field failed, but other data is returned successfully
BThe client sent an invalid authentication token
CThe server did not understand the query syntax
DThe entire query failed and no data is returned
Attempts:
2 left
💡 Hint

Field-level errors allow partial data with some fields failing.

📝 Syntax
advanced
2:00remaining
Which GraphQL error response is correctly formatted for a field-level error?

Choose the valid GraphQL error response that shows a field-level error for the 'price' field.

A{ "data": { "product": { "price": 100 } }, "errors": [{ "message": "Price error" }] }
B{ "data": { "product": { "price": null } }, "errors": [{ "message": "Price not available", "path": ["product", "price"] }] }
C{ "data": null, "errors": [{ "message": "Price not available" }] }
D{ "error": "Price field missing" }
Attempts:
2 left
💡 Hint

Field-level errors include a 'path' to the field and partial data.

🔧 Debug
advanced
2:30remaining
Find the mistake causing the field-level error in this GraphQL schema snippet

Given this GraphQL schema snippet, why might the 'email' field cause a field-level error?

type User {
  id: ID!
  name: String!
  email: String
}

query {
  user(id: "1") {
    id
    name
    email
  }
}
AThe 'email' field is non-nullable but the resolver returns null
BThe 'id' field is not defined in the schema
CThe 'name' field is missing in the query causing the error
DThe 'email' field is nullable but the resolver returns null without error handling
Attempts:
2 left
💡 Hint

Nullable fields can return null but may cause errors if not handled properly.

optimization
expert
3:00remaining
How to minimize field-level errors in a complex GraphQL query?

You have a complex GraphQL query fetching multiple nested fields. Which approach best reduces field-level errors?

AImplement detailed error handling in each resolver to return partial data and clear error messages
BRemove all nullable fields from the schema to avoid nulls in responses
CUse error masking to hide all errors and always return null for failed fields
DDisable error reporting in the GraphQL server to prevent errors from reaching clients
Attempts:
2 left
💡 Hint

Good error handling helps clients understand and handle partial failures.