Complete Support for core 2.3.0

- graphql-relay from_global_id no longer throws an exception if we fail to decode the id.
- So handle the case of it returning empty strings instead.
This commit is contained in:
Jonny Wylie 2022-04-19 07:21:21 +01:00
parent 989970f893
commit 4e0e18d168
2 changed files with 8 additions and 1 deletions

View File

@ -97,6 +97,13 @@ class Node(AbstractNode):
f"Exception message: {str(e)}" f"Exception message: {str(e)}"
) )
# from_global_id returns "" in the case of decode errors
if _type == "" and _id == "":
raise Exception(
f'Unable to parse global ID "{global_id}". '
'Make sure it is a base64 encoded string in the format: "TypeName:id". '
)
graphene_type = info.schema.get_type(_type) graphene_type = info.schema.get_type(_type)
if graphene_type is None: if graphene_type is None:
raise Exception(f'Relay Node "{_type}" not found in schema') raise Exception(f'Relay Node "{_type}" not found in schema')

View File

@ -1,5 +1,5 @@
from promise import Promise, is_thenable from promise import Promise, is_thenable
from graphql.error import format_error as format_graphql_error from graphql.error.graphql_error import format_error as format_graphql_error
from graphql.error import GraphQLError from graphql.error import GraphQLError
from graphene.types.schema import Schema from graphene.types.schema import Schema