Skip to content

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

Refactor menu error codes

Aleksander Spyrafc0f07a8a540
diff --git a/saleor/graphql/core/utils/error_codes.py b/saleor/graphql/core/utils/error_codes.py
index fe4744fbf3..ff24eebe0a 100644
--- a/saleor/graphql/core/utils/error_codes.py
+++ b/saleor/graphql/core/utils/error_codes.py
@@ -71,8 +71,7 @@ class CheckoutErrorCode(Enum):
class MenuErrorCode(Enum):
- ASSIGN_MENU_ITEM_TO_ITSELF = "assign_menu_item_to_itself"
- CANNOT_ASSIGN_NOTE = "cannot_assign_node"
+ CANNOT_ASSIGN_NODE = "cannot_assign_node"
INVALID_MENU_ITEM = "invalid_menu_item"
NO_MENU_ITEM_PROVIDED = "no_item_provided"
TOO_MANY_MENU_ITEMS = "too_many_items"
diff --git a/saleor/graphql/menu/mutations.py b/saleor/graphql/menu/mutations.py
index 8f5f682c26..5fb9e93b0e 100644
--- a/saleor/graphql/menu/mutations.py
+++ b/saleor/graphql/menu/mutations.py
@@ -267,7 +267,7 @@ class MenuItemMove(BaseMutation):
{
"parent": ValidationError(
"Cannot assign a node to itself.",
- code=MenuErrorCode.ASSIGN_MENU_ITEM_TO_ITSELF,
+ code=MenuErrorCode.CANNOT_ASSIGN_NODE,
)
}
)
@@ -285,7 +285,7 @@ class MenuItemMove(BaseMutation):
"Cannot assign a node as child of "
"one of its descendants."
),
- code=MenuErrorCode.CANNOT_ASSIGN_NOTE,
+ code=MenuErrorCode.CANNOT_ASSIGN_NODE,
)
}
)
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 52051465a5..ca68a1077d 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -1388,7 +1388,6 @@ type Error {
enum ErrorCode {
ACTIVATE_OWN_ACCOUNT
ACTIVATE_SUPERUSER_ACCOUNT
- ASSIGN_MENU_ITEM_TO_ITSELF
ATTRIBUTE_ALREADY_ASSIGNED
ATTRIBUTE_BAD_VALUE
ATTRIBUTE_CANNOT_BE_ASSIGNED