Skip to content

A possible minor bug in ExecutionContext.complete_value #187

Closed
@ipeterov

Description

@ipeterov

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdiscussionNeeds more discussion

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions