import { CombinedGraphQLErrors, CombinedProtocolErrors, LocalStateError, ServerError, ServerParseError, UnconventionalError, } from "@apollo/client/errors"; // about apollo client error handle https://www.apollographql.com/docs/react/data/error-handling // Comprehensive error handling example. function handleError(error: unknown) { if (CombinedGraphQLErrors.is(error)) { // Handle GraphQL errors } else if (CombinedProtocolErrors.is(error)) { // Handle multipart subscription protocol errors } else if (LocalStateError.is(error)) { // Handle errors thrown by the `LocalState` class } else if (ServerError.is(error)) { // Handle server HTTP errors } else if (ServerParseError.is(error)) { // Handle JSON parse errors } else if (UnconventionalError.is(error)) { // Handle errors thrown by irregular types } else { // Handle other errors } }