Skip to content

Commit dce6528

Browse files
Remove deprecate printError/formatError methods (#3582)
1 parent f44cb4e commit dce6528

File tree

4 files changed

+3
-41
lines changed

4 files changed

+3
-41
lines changed

src/error/GraphQLError.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -237,23 +237,3 @@ export interface GraphQLFormattedError {
237237
*/
238238
readonly extensions?: { [key: string]: unknown };
239239
}
240-
241-
/**
242-
* Prints a GraphQLError to a string, representing useful location information
243-
* about the error's position in the source.
244-
*
245-
* @deprecated Please use `error.toString` instead. Will be removed in v17
246-
*/
247-
export function printError(error: GraphQLError): string {
248-
return error.toString();
249-
}
250-
251-
/**
252-
* Given a GraphQLError, format it according to the rules described by the
253-
* Response Format, Errors section of the GraphQL Specification.
254-
*
255-
* @deprecated Please use `error.toJSON` instead. Will be removed in v17
256-
*/
257-
export function formatError(error: GraphQLError): GraphQLFormattedError {
258-
return error.toJSON();
259-
}

src/error/__tests__/GraphQLError-test.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Kind } from '../../language/kinds';
99
import { parse } from '../../language/parser';
1010
import { Source } from '../../language/source';
1111

12-
import { formatError, GraphQLError, printError } from '../GraphQLError';
12+
import { GraphQLError } from '../GraphQLError';
1313

1414
const source = new Source(dedent`
1515
{
@@ -223,11 +223,6 @@ describe('GraphQLError', () => {
223223
});
224224

225225
describe('toString', () => {
226-
it('Deprecated: prints an error using printError', () => {
227-
const error = new GraphQLError('Error');
228-
expect(printError(error)).to.equal('Error');
229-
});
230-
231226
it('prints an error without location', () => {
232227
const error = new GraphQLError('Error without location');
233228
expect(error.toString()).to.equal('Error without location');
@@ -294,13 +289,6 @@ describe('toString', () => {
294289
});
295290

296291
describe('toJSON', () => {
297-
it('Deprecated: format an error using formatError', () => {
298-
const error = new GraphQLError('Example Error');
299-
expect(formatError(error)).to.deep.equal({
300-
message: 'Example Error',
301-
});
302-
});
303-
304292
it('includes path', () => {
305293
const error = new GraphQLError('msg', { path: ['path', 3, 'to', 'field'] });
306294

src/error/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { GraphQLError, printError, formatError } from './GraphQLError';
1+
export { GraphQLError } from './GraphQLError';
22
export type {
33
GraphQLErrorOptions,
44
GraphQLFormattedError,

src/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,7 @@ export {
377377
export type { ValidationRule } from './validation/index';
378378

379379
// Create, format, and print GraphQL errors.
380-
export {
381-
GraphQLError,
382-
syntaxError,
383-
locatedError,
384-
printError,
385-
formatError,
386-
} from './error/index';
380+
export { GraphQLError, syntaxError, locatedError } from './error/index';
387381

388382
export type {
389383
GraphQLErrorOptions,

0 commit comments

Comments
 (0)