Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Consider case when no nodes were found

akjanik9c097434f2a5
diff --git a/saleor/graphql/utils.py b/saleor/graphql/utils.py
index 8984681ba0..d39336f371 100644
--- a/saleor/graphql/utils.py
+++ b/saleor/graphql/utils.py
@@ -23,7 +23,12 @@ def get_nodes(ids, graphene_type):
assert str(graphene_type) == _type, (
'Must receive an {} id.').format(graphene_type._meta.name)
pks.append(_id)
- return graphene_type._meta.model.objects.filter(pk__in=pks)
+ nodes = graphene_type._meta.model.objects.filter(pk__in=pks)
+ if not nodes:
+ raise Exception(
+ "Could not resolve to a nodes with the global id list of '%s'."
+ % ids)
+ return nodes
def get_attributes_dict_from_list(attributes, attr_slug_id):