Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove catching exceptions from create_stocks
IKarbowiak76fe1b80f034
diff --git a/saleor/graphql/product/bulk_mutations/products.py b/saleor/graphql/product/bulk_mutations/products.pyindex fd77570a09..c49c1eaba6 100644--- a/saleor/graphql/product/bulk_mutations/products.py+++ b/saleor/graphql/product/bulk_mutations/products.py@@ -336,11 +336,7 @@ class ProductVariantStocksBulkCreate(BaseMutation):warehouses = cls.clean_stocks_input(variant, stocks, errors)if errors:raise ValidationError(errors)- try:- create_stocks(variant, stocks, warehouses)- except ValidationError as error:- error.code = ProductErrorCode.UNIQUE- raise ValidationError({"warehouse": error})+ create_stocks(variant, stocks, warehouses)return cls(product_variant=variant)@classmethoddiff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.pyindex c1f0df8adf..ddef3241ed 100644--- a/saleor/graphql/product/mutations/products.py+++ b/saleor/graphql/product/mutations/products.py@@ -949,11 +949,7 @@ class ProductCreate(ModelMutation):warehouses = cls.get_nodes_or_error(warehouse_ids, "warehouse", only_type=Warehouse)- try:- create_stocks(variant, stocks, warehouses)- except ValidationError as error:- error.code = ProductErrorCode.UNIQUE- raise ValidationError({"stocks": error})+ create_stocks(variant, stocks, warehouses)@classmethoddef _save_m2m(cls, info, instance, cleaned_data):@@ -1263,11 +1259,7 @@ class ProductVariantCreate(ModelMutation):warehouses = cls.get_nodes_or_error(warehouse_ids, "warehouse", only_type=Warehouse)- try:- create_stocks(variant, stocks, warehouses)- except ValidationError as error:- error.code = ProductErrorCode.UNIQUE- raise ValidationError({"stocks": error})+ create_stocks(variant, stocks, warehouses)class ProductVariantUpdate(ProductVariantCreate):