Skip to content

Commit 505d554

Browse files
committed
Remove deprecated print_rrror/format_error functions
Replicates graphql/graphql-js@dce6528
1 parent dbe6bb9 commit 505d554

File tree

2 files changed

+0
-51
lines changed

2 files changed

+0
-51
lines changed

src/graphql/error/graphql_error.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -236,30 +236,3 @@ def formatted(self) -> GraphQLFormattedError:
236236
if self.extensions:
237237
formatted["extensions"] = self.extensions
238238
return formatted
239-
240-
241-
def print_error(error: GraphQLError) -> str:
242-
"""Print a GraphQLError to a string.
243-
244-
Represents useful location information about the error's position in the source.
245-
246-
.. deprecated:: 3.2
247-
Please use ``str(error)`` instead. Will be removed in v3.3.
248-
"""
249-
if not isinstance(error, GraphQLError):
250-
raise TypeError("Expected a GraphQLError.")
251-
return str(error)
252-
253-
254-
def format_error(error: GraphQLError) -> GraphQLFormattedError:
255-
"""Format a GraphQL error.
256-
257-
Given a GraphQLError, format it according to the rules described by the "Response
258-
Format, Errors" section of the GraphQL Specification.
259-
260-
.. deprecated:: 3.2
261-
Please use ``error.formatted`` instead. Will be removed in v3.3.
262-
"""
263-
if not isinstance(error, GraphQLError):
264-
raise TypeError("Expected a GraphQLError.")
265-
return error.formatted

tests/error/test_graphql_error.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,6 @@ def hashes_are_unique_per_instance():
273273

274274

275275
def describe_to_string():
276-
def deprecated_prints_an_error_using_print_error():
277-
# noinspection PyProtectedMember
278-
from graphql.error.graphql_error import print_error
279-
280-
error = GraphQLError("Error")
281-
assert print_error(error) == "Error"
282-
with raises(TypeError) as exc_info:
283-
# noinspection PyTypeChecker
284-
print_error(Exception) # type: ignore
285-
assert str(exc_info.value) == "Expected a GraphQLError."
286-
287276
def prints_an_error_without_location():
288277
error = GraphQLError("Error without location")
289278
assert str(error) == "Error without location"
@@ -353,19 +342,6 @@ def prints_an_error_with_nodes_from_different_sources():
353342

354343

355344
def describe_formatted():
356-
def deprecated_formats_an_error_using_format_error():
357-
# noinspection PyProtectedMember
358-
from graphql.error.graphql_error import format_error
359-
360-
error = GraphQLError("Example Error")
361-
assert format_error(error) == {
362-
"message": "Example Error",
363-
}
364-
with raises(TypeError) as exc_info:
365-
# noinspection PyTypeChecker
366-
format_error(Exception) # type: ignore
367-
assert str(exc_info.value) == "Expected a GraphQLError."
368-
369345
def formats_graphql_error():
370346
path: List[Union[int, str]] = ["one", 2]
371347
extensions = {"ext": None}

0 commit comments

Comments
 (0)