Skip to content

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

Add ValueError message

Michał Sipa11faad80b110
diff --git a/saleor/graphql/core/scalars.py b/saleor/graphql/core/scalars.py
index dd31ec4091..f6606d1e05 100644
--- a/saleor/graphql/core/scalars.py
+++ b/saleor/graphql/core/scalars.py
@@ -46,7 +46,7 @@ class WeightScalar(graphene.Scalar):
default_unit = get_default_weight_unit()
weight = Weight(**{default_unit: value})
if not weight:
- raise ValueError()
+ raise ValueError(f"Unsupported value: {node.value}")
return weight
@staticmethod
@@ -66,7 +66,7 @@ class WeightScalar(graphene.Scalar):
else:
weight = WeightScalar.parse_literal_decimal(node)
if not weight:
- raise ValueError()
+ raise ValueError(f"Unsupported value: {node.value}")
return weight
@staticmethod
diff --git a/tests/api/test_product.py b/tests/api/test_product.py
index e50a10c691..fd76c14ad4 100644
--- a/tests/api/test_product.py
+++ b/tests/api/test_product.py
@@ -3971,7 +3971,6 @@ mutation createProduct(
$category: ID!
$name: String!,
$sku: String,
- $quantity: Int,
$basePrice: Decimal!
$weight: WeightScalar
$trackInventory: Boolean)
@@ -3983,7 +3982,6 @@ mutation createProduct(
name: $name,
sku: $sku,
trackInventory: $trackInventory,
- quantity: $quantity,
basePrice: $basePrice,
weight: $weight
})
@@ -4019,7 +4017,6 @@ mutation createProduct(
$category: ID!
$name: String!,
$sku: String,
- $quantity: Int,
$basePrice: Decimal!
$trackInventory: Boolean)
{{
@@ -4030,7 +4027,6 @@ mutation createProduct(
name: $name,
sku: $sku,
trackInventory: $trackInventory,
- quantity: $quantity,
basePrice: $basePrice,
weight: {weight}
}})
@@ -4088,7 +4084,6 @@ def test_create_product_with_weight_variable(
"category": category_id,
"productType": product_type_id,
"name": "Test",
- "quantity": 8,
"sku": "23434",
"trackInventory": True,
"basePrice": Decimal("19"),
@@ -4134,7 +4129,6 @@ def test_create_product_with_weight_input(
"category": category_id,
"productType": product_type_id,
"name": "Test",
- "quantity": 8,
"sku": "23434",
"trackInventory": True,
"basePrice": Decimal("19"),