Skip to content

Commit 134e304

Browse files
committed
Improve coverage in graphql module
Don't wrap unexpected errors as GraphQLErrors.
1 parent f2535f4 commit 134e304

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/graphql/graphql.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ def graphql_impl(
153153
document = parse(source)
154154
except GraphQLError as error:
155155
return ExecutionResult(data=None, errors=[error])
156-
except Exception as error:
157-
error = GraphQLError(str(error), original_error=error)
158-
return ExecutionResult(data=None, errors=[error])
159156

160157
# Validate
161158
from .validation import validate

tests/execution/test_sync.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ def does_not_return_a_promise_for_validation_errors():
9292
],
9393
)
9494

95+
def raises_a_type_error_when_no_query_is_passed():
96+
with raises(TypeError) as exc_info:
97+
# noinspection PyTypeChecker
98+
assert graphql_sync(schema, None) # type: ignore
99+
msg = str(exc_info.value)
100+
assert msg == "Must provide Source. Received: None."
101+
95102
def does_not_return_a_promise_for_sync_execution():
96103
doc = "query Example { syncField }"
97104
assert graphql_sync(schema, doc, "rootValue") == (

0 commit comments

Comments
 (0)