UNPKG

1.84 kBTypeScriptView Raw
1import { GraphQLError, GraphQLFormattedError } from 'graphql';
2export declare class ApolloError extends Error implements GraphQLError {
3 extensions: Record<string, any>;
4 readonly name: any;
5 readonly locations: any;
6 readonly path: any;
7 readonly source: any;
8 readonly positions: any;
9 readonly nodes: any;
10 originalError: any;
11 [key: string]: any;
12 constructor(message: string, code?: string, extensions?: Record<string, any>);
13}
14export declare function toApolloError(error: Error & {
15 extensions?: Record<string, any>;
16}, code?: string): Error & {
17 extensions: Record<string, any>;
18};
19export interface ErrorOptions {
20 code?: string;
21 errorClass?: new (message: string) => ApolloError;
22}
23export declare function fromGraphQLError(error: GraphQLError, options?: ErrorOptions): ApolloError;
24export declare class SyntaxError extends ApolloError {
25 constructor(message: string);
26}
27export declare class ValidationError extends ApolloError {
28 constructor(message: string);
29}
30export declare class AuthenticationError extends ApolloError {
31 constructor(message: string);
32}
33export declare class ForbiddenError extends ApolloError {
34 constructor(message: string);
35}
36export declare class PersistedQueryNotFoundError extends ApolloError {
37 constructor();
38}
39export declare class PersistedQueryNotSupportedError extends ApolloError {
40 constructor();
41}
42export declare class UserInputError extends ApolloError {
43 constructor(message: string, properties?: Record<string, any>);
44}
45export declare function formatApolloErrors(errors: ReadonlyArray<Error>, options?: {
46 formatter?: (error: GraphQLError) => GraphQLFormattedError;
47 debug?: boolean;
48}): Array<ApolloError>;
49export declare function hasPersistedQueryError(errors: Array<Error>): boolean;
50//# sourceMappingURL=index.d.ts.map
\No newline at end of file