Closed
Description
I'm trying to figure out a way to return None
for non-nullable fields if the requesting user doesn't have permission to view them.
I was trying to pass Undefined
from graphql.pyutils.undefined
, but it doesn't work. It looks like the second check in this line
# If result value is null or undefined then return null.
if result is None or result is Undefined:
return None
can never run because Undefined
is actually a descendant of ValueError
and therefore triggers this check.
if isinstance(result, Exception):
raise result
I don't know if this was meant as an escape hatch for returning null values if you really wanted to (which is what I really need right now), but the code itself seems wrong either way.