Skip to content

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

Remove unnecessary codes

Aleksander Spyraeab249b86942
diff --git a/saleor/graphql/core/utils/error_codes.py b/saleor/graphql/core/utils/error_codes.py
index 90c0a06238..caa5b71220 100644
--- a/saleor/graphql/core/utils/error_codes.py
+++ b/saleor/graphql/core/utils/error_codes.py
@@ -105,7 +105,6 @@ class OrderErrorCode(Enum):
NULL = "null"
OBJECT_DOES_NOT_EXIST = "object_does_not_exist"
ORDER_INVALID_SHIPPING_METHOD = "order_invalid_shipping_method"
- ORDER_NO_PRODUCTS = "order_without_products"
ORDER_NO_SHIPPING_ADDRESS = "order_no_shipping_address"
PAYMENT_ERROR = "payment_error"
PAYMENT_MISSING = "payment_missing"
@@ -121,19 +120,14 @@ class ProductErrorCode(Enum):
ATTRIBUTE_BAD_VALUE = "attribute_bad_value"
ATTRIBUTE_CANNOT_BE_ASSIGNED = "attribute_cannot_be_assigned"
ATTRIBUTE_DISABLED_VARIANTS = "attribute_disabled_variants"
- ATTRIBUTE_NON_ASSIGNABLE = "attribute_non_assignable"
GRAPHQL_ERROR = "graphql_error"
- INCORRECT_VALUE = "incorrect_value"
INVALID = "invalid"
- MISSING_CONFIGURATION_FIELDS = "missing_configuration_fields"
- MISSING_VALUE = "missing_value"
NOT_PRODUCTS_IMAGE = "not_products_image"
NULL = "null"
OBJECT_ALREADY_EXISTS = "object_already_exists"
OBJECT_DOES_NOT_EXIST = "object_does_not_exist"
REQUIRED = "required"
UNIQUE = "unique"
- VALUE_ERROR = "value_error"
VARIANT_NO_DIGITAL_CONTENT = "variant_no_digital_content"
diff --git a/saleor/graphql/order/utils.py b/saleor/graphql/order/utils.py
index 4a0d0b8b47..52d04a641d 100644
--- a/saleor/graphql/order/utils.py
+++ b/saleor/graphql/order/utils.py
@@ -9,7 +9,7 @@ def validate_total_quantity(order):
{
"lines": ValidationError(
"Could not create order without any products.",
- code=OrderErrorCode.ORDER_NO_PRODUCTS,
+ code=OrderErrorCode.REQUIRED,
)
}
)
diff --git a/saleor/graphql/product/mutations/attributes.py b/saleor/graphql/product/mutations/attributes.py
index aeccabf3e6..138449210c 100644
--- a/saleor/graphql/product/mutations/attributes.py
+++ b/saleor/graphql/product/mutations/attributes.py
@@ -374,7 +374,7 @@ class AttributeAssign(BaseProductMutation):
f"{AttributeInputType.NON_ASSIGNABLE_TO_VARIANTS} "
f"cannot be assigned as variant attributes"
),
- code=ProductErrorCode.ATTRIBUTE_NON_ASSIGNABLE,
+ code=ProductErrorCode.ATTRIBUTE_CANNOT_BE_ASSIGNED,
)
}
)
diff --git a/saleor/graphql/product/mutations/digital_contents.py b/saleor/graphql/product/mutations/digital_contents.py
index c2f65a6d19..81a429d659 100644
--- a/saleor/graphql/product/mutations/digital_contents.py
+++ b/saleor/graphql/product/mutations/digital_contents.py
@@ -80,8 +80,7 @@ class DigitalContentCreate(BaseProductMutation):
if missing_fields:
msg += "{}, " * len(missing_fields)
raise ValidationError(
- msg.format(*missing_fields),
- code=ProductErrorCode.MISSING_CONFIGURATION_FIELDS,
+ msg.format(*missing_fields), code=ProductErrorCode.REQUIRED
)
return data
@@ -171,8 +170,7 @@ class DigitalContentUpdate(BaseProductMutation):
if missing_fields:
msg += "{}, " * len(missing_fields)
raise ValidationError(
- msg.format(*missing_fields),
- code=ProductErrorCode.MISSING_CONFIGURATION_FIELDS,
+ msg.format(*missing_fields), code=ProductErrorCode.REQUIRED
)
return data
diff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.py
index c43940dfbe..0d8f3d24c4 100644
--- a/saleor/graphql/product/mutations/products.py
+++ b/saleor/graphql/product/mutations/products.py
@@ -1328,7 +1328,7 @@ class ProductImageReorder(BaseProductMutation):
{
"order": ValidationError(
"Incorrect number of image IDs provided.",
- code=ProductErrorCode.INCORRECT_VALUE,
+ code=ProductErrorCode.INVALID,
)
}
)
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 538f5b1b0b..758d81189f 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -2355,7 +2355,6 @@ enum OrderErrorCode {
NULL
OBJECT_DOES_NOT_EXIST
ORDER_INVALID_SHIPPING_METHOD
- ORDER_NO_PRODUCTS
ORDER_NO_SHIPPING_ADDRESS
PAYMENT_ERROR
PAYMENT_MISSING
@@ -2902,19 +2901,14 @@ enum ProductErrorCode {
ATTRIBUTE_BAD_VALUE
ATTRIBUTE_CANNOT_BE_ASSIGNED
ATTRIBUTE_DISABLED_VARIANTS
- ATTRIBUTE_NON_ASSIGNABLE
GRAPHQL_ERROR
- INCORRECT_VALUE
INVALID
- MISSING_CONFIGURATION_FIELDS
- MISSING_VALUE
NOT_PRODUCTS_IMAGE
NULL
OBJECT_ALREADY_EXISTS
OBJECT_DOES_NOT_EXIST
REQUIRED
UNIQUE
- VALUE_ERROR
VARIANT_NO_DIGITAL_CONTENT
}