Skip to content

Commit 37161b2

Browse files
Jackson KearlIvanGoncharov
authored andcommitted
Add .d.ts comments to flow
1 parent d84cfca commit 37161b2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/error/formatError.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,31 @@ export function formatError(error: GraphQLError): GraphQLFormattedError {
2222
: { message, locations, path };
2323
}
2424

25+
/**
26+
* @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors
27+
*/
2528
export type GraphQLFormattedError = {|
29+
/**
30+
* A short, human-readable summary of the problem that **SHOULD NOT** change
31+
* from occurrence to occurrence of the problem, except for purposes of
32+
* localization.
33+
*/
2634
+message: string,
35+
/**
36+
* If an error can be associated to a particular point in the requested
37+
* GraphQL document, it should contain a list of locations.
38+
*/
2739
+locations: $ReadOnlyArray<SourceLocation> | void,
40+
/**
41+
* If an error can be associated to a particular field in the GraphQL result,
42+
* it _must_ contain an entry with the key `path` that details the path of
43+
* the response field which experienced the error. This allows clients to
44+
* identify whether a null result is intentional or caused by a runtime error.
45+
*/
2846
+path: $ReadOnlyArray<string | number> | void,
47+
/**
48+
* Reserved for implementors to extend the protocol however they see fit,
49+
* and hence there are no additional restrictions on its contents.
50+
*/
2951
+extensions?: { [key: string]: mixed, ... },
3052
|};

0 commit comments

Comments
 (0)