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