import { BaseError } from '@pawells/typescript-common'; import type { TErrorMetadata } from '@pawells/typescript-common'; /** * Error metadata type for {@link GraphQLClientError}. */ export type TGraphQLClientErrorMetadata = TErrorMetadata; /** * Error thrown by `@pawells/react-graphql` for client-creation and context-usage failures. * * Extends `@pawells/typescript-common`'s `BaseError` with a `code` property and cause chaining. * * @example * ```typescript * try { * createGraphQLClient({ httpUri: 'http://api.example.com/graphql', wsUri: 'wss://api.example.com/graphql', name: 'app' }); * } catch (error) { * if (error instanceof GraphQLClientError && error.Code === GraphQLClientError.Code.INSECURE_HTTP) { * console.error('HTTP endpoint must use https:// outside localhost'); * } * } * ``` */ export declare class GraphQLClientError extends BaseError { /** * Enumeration of `@pawells/react-graphql` error codes for classification and debugging. * * - `INSECURE_WEBSOCKET` — `wsUri` uses `ws://` for a non-localhost host. * - `INSECURE_HTTP` — `httpUri` uses `http://` for a non-localhost host. * - `CONTEXT_NOT_FOUND` — `useGraphQLContext` (or a hook built on it) was called outside `GraphQLProvider`. */ static readonly Code: Readonly<{ readonly INSECURE_WEBSOCKET: "GRAPHQL_INSECURE_WEBSOCKET"; readonly INSECURE_HTTP: "GRAPHQL_INSECURE_HTTP"; readonly CONTEXT_NOT_FOUND: "GRAPHQL_CONTEXT_NOT_FOUND"; }>; /** * Creates a new GraphQLClientError instance with a code, message, and optional cause chain. * * The code property is accessible via the `Code` getter (inherited from BaseError). * The cause chain is accessible via the `Cause` getter (inherited from BaseError). * Error metadata (code, cause) is accessible via the `Metadata` getter (inherited from BaseError). * * @param code - Error code for classification (one of {@link GraphQLClientError.Code}'s values) * @param message - Human-readable error message describing the failure * @param options - Optional configuration object * @param options.cause - Original error to chain for root cause analysis * * @example * ```typescript * throw new GraphQLClientError( * GraphQLClientError.Code.INSECURE_WEBSOCKET, * 'GraphQL subscriptions require WSS (wss://) for secure token transmission.' * ); * ``` */ constructor(code: string, message: string, options?: { cause?: Error; }); } //# sourceMappingURL=errors.d.ts.map