UNPKG

1.01 kBTypeScriptView Raw
1import { ApolloLink, Observable, Operation, NextLink, FetchResult } from 'apollo-link';
2import { GraphQLError, ExecutionResult } from 'graphql';
3import { ServerError, ServerParseError } from 'apollo-link-http-common';
4export interface ErrorResponse {
5 graphQLErrors?: ReadonlyArray<GraphQLError>;
6 networkError?: Error | ServerError | ServerParseError;
7 response?: ExecutionResult;
8 operation: Operation;
9 forward: NextLink;
10}
11export declare namespace ErrorLink {
12 /**
13 * Callback to be triggered when an error occurs within the link stack.
14 */
15 interface ErrorHandler {
16 (error: ErrorResponse): Observable<FetchResult> | void;
17 }
18}
19export import ErrorHandler = ErrorLink.ErrorHandler;
20export declare const onError: (errorHandler: ErrorHandler) => ApolloLink;
21export declare class ErrorLink extends ApolloLink {
22 private link;
23 constructor(errorHandler: ErrorLink.ErrorHandler);
24 request(operation: Operation, forward: NextLink): Observable<FetchResult> | null;
25}