An abstracted Error that provides either a networkError or graphQLErrors.

Remarks

During a GraphQL request, either the request can fail entirely, causing a network error, or the GraphQL execution or fields can fail, which will cause an ExecutionResult to contain an array of GraphQL errors.

The CombinedError abstracts and normalizes both failure cases. When error is set to this error, the CombinedError abstracts all errors, making it easier to handle only a subset of error cases.

See

https://urql.dev/goto/docs/basics/errors for more information on handling GraphQL errors and the CombinedError.

Hierarchy

Constructors

  • Parameters

    • input: {
          graphQLErrors?: (string | ErrorLike)[];
          networkError?: Error;
          response?: any;
      }
      • Optional graphQLErrors?: (string | ErrorLike)[]
      • Optional networkError?: Error
      • Optional response?: any

    Returns CombinedError

Properties

graphQLErrors: GraphQLError[]

A list of GraphQL errors rehydrated from a ExecutionResult.

Remarks

If an ExecutionResult received from the API contains a list of errors, the CombinedError will rehydrate them, normalize them to GraphQLErrors and list them here. An empty list indicates that no GraphQL error has been sent by the API.

message: string
name: string
networkError?: Error

Set to an error, if a GraphQL request has failed outright.

Remarks

A GraphQL over HTTP request may fail and not reach the API. Any error that prevents a GraphQl request outright, will be considered a “network error” and set here.

response?: any

Set to the Response object a fetch exchange received.

Remarks

If a built-in fetch Exchange is used in urql, this may be set to the Response object of the Fetch API response. However, since urql doesn’t assume that all users will use HTTP as the only or exclusive transport for GraphQL this property is neither typed nor guaranteed and may be re-used for other purposes by non-fetch exchanges.

Hint: It can be useful to use response.status here, however, if you plan on relying on this being a Response in your app, which it is by default, then make sure you add some extra checks before blindly assuming so!

stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Type declaration

stackTraceLimit: number

Methods

  • Returns string

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

Generated using TypeDoc