Q43: How do you format errors or mask sensitive details in production?

Difficulty:AdvancedTopic:Security & Operations

By overriding the formatError hook in GraphQL engines (e.g., Apollo Server, GraphQL Yoga), servers can intercept errors before delivery. In production, stack traces and database internal details are masked or logged centrally, returning clean, user-friendly codes.

Key Takeaways
  • Always sanitize formatError pipelines in production to avoid leaking database schemas or stack traces.
Knowledge Check

What risk occurs if default error formatting is left unconfigured in production?