serialization error
claudiuapetrei opened this issue · comments
Hi,
Is it expected behavior for a serialization errors to be TypeError insted of GraphQLError ?
For example the test below where the resolver returns a dict instead of int, had a issues and it was a bit hard to debug without the exception.path info.
def test_serialization_message():
# type: () -> None
ast = parse("query Example { int_resolved_as_dict }")
def resolver(context, *_):
return {}
Type = GraphQLObjectType(
"Type", {"int_resolved_as_dict": GraphQLField(GraphQLInt, resolver=resolver)}
)
result = execute(GraphQLSchema(Type), ast)
assert isinstance(result.errors[0], GraphQLError)
The issues seems to be in executor.py complete_leaf_value.
As far as I see, this is expected in GraphQL core 2. complete_value_catching_error generally does not wrap errors as GraphQLLocatedErrors.
Note that this is all fixed in GraphQL core 3. GraphQL core 2 is not maintained and improved any more, except for security fixes and actual bugs.