Skip to content

Commit 4c416d4

Browse files
committed
Combine invariants into AST-aware error.
Related GraphQL-js commit: graphql/graphql-js@6e736bf
1 parent 0ede894 commit 4c416d4

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

graphql/execution/executor.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,21 +315,16 @@ def complete_abstract_value(exe_context, return_type, field_asts, info, result):
315315
else:
316316
runtime_type = get_default_resolve_type_fn(result, exe_context.context_value, info, return_type)
317317

318-
assert runtime_type, (
319-
'Could not determine runtime type of value "{}" for field {}.{}.'.format(
320-
result,
321-
info.parent_type,
322-
info.field_name
323-
))
324-
325318
assert isinstance(runtime_type, GraphQLObjectType), (
326-
'{}.resolveType must return an instance of GraphQLObjectType ' +
327-
'for field {}.{}, received "{}".'.format(
319+
'Abstract type {} must resolve to an Object type at runtime ' +
320+
'for field {}.{} with value "{}", received "{}".'
321+
).format(
328322
return_type,
329323
info.parent_type,
330324
info.field_name,
331325
result,
332-
))
326+
runtime_type,
327+
)
333328

334329
if not exe_context.schema.is_possible_type(return_type, runtime_type):
335330
raise GraphQLError(

0 commit comments

Comments
 (0)