Skip to content

Commit 2ed9820

Browse files
committed
1 parent ddfc429 commit 2ed9820

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

graphql/utilities/build_client_schema.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,19 @@ def get_named_type(type_name: str) -> GraphQLNamedType:
104104
def get_input_type(type_ref: Dict) -> GraphQLInputType:
105105
input_type = get_type(type_ref)
106106
if not is_input_type(input_type):
107-
raise TypeError("Introspection must provide input type for arguments.")
107+
raise TypeError(
108+
"Introspection must provide input type for arguments,"
109+
f" but received: {inspect(input_type)}."
110+
)
108111
return cast(GraphQLInputType, input_type)
109112

110113
def get_output_type(type_ref: Dict) -> GraphQLOutputType:
111114
output_type = get_type(type_ref)
112115
if not is_output_type(output_type):
113-
raise TypeError("Introspection must provide output type for fields.")
116+
raise TypeError(
117+
"Introspection must provide output type for fields,"
118+
f" but received: {inspect(output_type)}."
119+
)
114120
return cast(GraphQLOutputType, output_type)
115121

116122
def get_object_type(type_ref: Dict) -> GraphQLObjectType:

tests/utilities/test_build_client_schema.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ def throws_when_output_type_is_used_as_an_arg_type():
598598

599599
assert str(exc_info.value).startswith(
600600
"Query fields cannot be resolved:"
601-
" Introspection must provide input type for arguments."
601+
" Introspection must provide input type for arguments,"
602+
" but received: SomeUnion."
602603
)
603604

604605
def throws_when_input_type_is_used_as_a_field_type():
@@ -617,7 +618,8 @@ def throws_when_input_type_is_used_as_a_field_type():
617618

618619
assert str(exc_info.value).startswith(
619620
"Query fields cannot be resolved:"
620-
" Introspection must provide output type for fields."
621+
" Introspection must provide output type for fields,"
622+
" but received: SomeInputObject."
621623
)
622624

623625
def throws_when_missing_possible_types():

0 commit comments

Comments
 (0)