Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/error/GraphQLError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ export interface GraphQLErrorExtensions {
[attributeName: string]: unknown;
}

/**
* Custom formatted extensions
*
* @remarks
* Use a unique identifier name for your extension, for example the name of
* your library or project. Do not use a shortened identifier as this increases
* the risk of conflicts. We recommend you add at most one extension field,
* an object which can contain all the values you need.
*/
export interface GraphQLFormattedErrorExtensions {
[attributeName: string]: unknown;
}

export interface GraphQLErrorOptions {
nodes?: ReadonlyArray<ASTNode> | ASTNode | null;
source?: Maybe<Source>;
Expand Down Expand Up @@ -275,7 +288,7 @@ export interface GraphQLFormattedError {
* Reserved for implementors to extend the protocol however they see fit,
* and hence there are no additional restrictions on its contents.
*/
readonly extensions?: { [key: string]: unknown };
readonly extensions?: GraphQLFormattedErrorExtensions;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/error/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type {
GraphQLErrorOptions,
GraphQLFormattedError,
GraphQLErrorExtensions,
GraphQLFormattedErrorExtensions,
} from './GraphQLError';

export { syntaxError } from './syntaxError';
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ export type {
GraphQLErrorOptions,
GraphQLFormattedError,
GraphQLErrorExtensions,
GraphQLFormattedErrorExtensions,
} from './error/index';

// Utilities for operating on GraphQL type schema and parsed sources.
Expand Down
Loading