Handling GraphQL Errors with Hasura & React
This article discusses handling errors in GraphQL APIs using Hasura and React. Unlike REST APIs, GraphQL API responses do not contain numerical codes by default, making it important for developers to understand the errors and how these errors are handled by their GraphQL tool of choice. The article covers common errors experienced in GraphQL APIs, handling GraphQL errors while building APIs with Hasura, and building custom error pages on a client-side React app. It also explains various categories of GraphQL errors, such as server errors, client errors, errors in the parse/validation phase of queries, and errors thrown within resolvers. The article provides examples of how to handle these errors using Apollo-link-error and apollo/react-hooks libraries. Additionally, it discusses handling errors at top levels and component levels, as well as error policies for handling partial data with errors in custom resolvers.
Company
Hasura
Date published
Nov. 26, 2019
Author(s)
Harsha
Word count
2267
Hacker News points
None found.
Language
English