Skip to content

Commit 9f4f26d

Browse files
committed
no cyclical deps
1 parent b3d8142 commit 9f4f26d

File tree

2 files changed

+38
-44
lines changed

2 files changed

+38
-44
lines changed

src/error/GraphQLError.d.ts

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { ASTNode } from '../language/ast';
44
import { Source } from '../language/source';
55
import { SourceLocation } from '../language/location';
66

7-
// eslint-disable-next-line import/no-cycle
8-
import { GraphQLFormattedError } from './formatError';
9-
107
/**
118
* Custom extensions
129
*
@@ -96,3 +93,40 @@ export class GraphQLError extends Error {
9693
* about the error's position in the source.
9794
*/
9895
export function printError(error: GraphQLError): string;
96+
97+
/**
98+
* Given a GraphQLError, format it according to the rules described by the
99+
* Response Format, Errors section of the GraphQL Specification.
100+
*/
101+
export function formatError(error: GraphQLError): GraphQLFormattedError;
102+
103+
/**
104+
* @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors
105+
*/
106+
export interface GraphQLFormattedError<
107+
TExtensions extends Record<string, any> = Record<string, any>
108+
> {
109+
/**
110+
* A short, human-readable summary of the problem that **SHOULD NOT** change
111+
* from occurrence to occurrence of the problem, except for purposes of
112+
* localization.
113+
*/
114+
readonly message: string;
115+
/**
116+
* If an error can be associated to a particular point in the requested
117+
* GraphQL document, it should contain a list of locations.
118+
*/
119+
readonly locations?: ReadonlyArray<SourceLocation>;
120+
/**
121+
* If an error can be associated to a particular field in the GraphQL result,
122+
* it _must_ contain an entry with the key `path` that details the path of
123+
* the response field which experienced the error. This allows clients to
124+
* identify whether a null result is intentional or caused by a runtime error.
125+
*/
126+
readonly path?: ReadonlyArray<string | number>;
127+
/**
128+
* Reserved for implementors to extend the protocol however they see fit,
129+
* and hence there are no additional restrictions on its contents.
130+
*/
131+
readonly extensions?: TExtensions;
132+
}

src/error/formatError.d.ts

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1 @@
1-
import { SourceLocation } from '../language/location';
2-
3-
// eslint-disable-next-line import/no-cycle
4-
import { GraphQLError } from './GraphQLError';
5-
6-
/**
7-
* Given a GraphQLError, format it according to the rules described by the
8-
* Response Format, Errors section of the GraphQL Specification.
9-
*/
10-
export function formatError(error: GraphQLError): GraphQLFormattedError;
11-
12-
/**
13-
* @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors
14-
*/
15-
export interface GraphQLFormattedError<
16-
TExtensions extends Record<string, any> = Record<string, any>
17-
> {
18-
/**
19-
* A short, human-readable summary of the problem that **SHOULD NOT** change
20-
* from occurrence to occurrence of the problem, except for purposes of
21-
* localization.
22-
*/
23-
readonly message: string;
24-
/**
25-
* If an error can be associated to a particular point in the requested
26-
* GraphQL document, it should contain a list of locations.
27-
*/
28-
readonly locations?: ReadonlyArray<SourceLocation>;
29-
/**
30-
* If an error can be associated to a particular field in the GraphQL result,
31-
* it _must_ contain an entry with the key `path` that details the path of
32-
* the response field which experienced the error. This allows clients to
33-
* identify whether a null result is intentional or caused by a runtime error.
34-
*/
35-
readonly path?: ReadonlyArray<string | number>;
36-
/**
37-
* Reserved for implementors to extend the protocol however they see fit,
38-
* and hence there are no additional restrictions on its contents.
39-
*/
40-
readonly extensions?: TExtensions;
41-
}
1+
export { formatError, GraphQLFormattedError } from './GraphQLError';

0 commit comments

Comments
 (0)