Skip to content

Commit 3c5ea56

Browse files
committed
Small fixes in runtime_type
1 parent 978b834 commit 3c5ea56

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

graphql/execution/executor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ def complete_leaf_value(return_type, result):
295295
return serialized_result
296296

297297

298-
# TODO: Refactor based on js implementation
299298
def complete_abstract_value(exe_context, return_type, field_asts, info, result):
300299
"""
301300
Complete an value of an abstract type by determining the runtime type of that value, then completing based
@@ -307,17 +306,18 @@ def complete_abstract_value(exe_context, return_type, field_asts, info, result):
307306
if isinstance(return_type, (GraphQLInterfaceType, GraphQLUnionType)):
308307
if return_type.resolve_type:
309308
runtime_type = return_type.resolve_type(result, info)
310-
if runtime_type and not return_type.is_possible_type(runtime_type):
311-
raise GraphQLError(
312-
u'Runtime Object type "{}" is not a possible type for "{}".'.format(runtime_type, return_type),
313-
field_asts
314-
)
315309
else:
316310
runtime_type = get_default_resolve_type_fn(result, info, return_type)
317311

318312
if not runtime_type:
319313
return None
320314

315+
if not return_type.is_possible_type(runtime_type):
316+
raise GraphQLError(
317+
u'Runtime Object type "{}" is not a possible type for "{}".'.format(runtime_type, return_type),
318+
field_asts
319+
)
320+
321321
return complete_object_value(exe_context, runtime_type, field_asts, info, result)
322322

323323

0 commit comments

Comments
 (0)