Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit a3d809c

Browse files
committed
The requested qty is not available" should be received instead of Internal server error
1 parent f211371 commit a3d809c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
7979
$currentUserId = $context->getUserId();
8080
$cart = $this->getCartForUser->execute((string)$cartHash, $currentUserId);
8181

82-
$this->addProductsToCart->execute($cart, $cartItems);
82+
try {
83+
$this->addProductsToCart->execute($cart, $cartItems);
84+
} catch (\Exception $exception) {
85+
throw new GraphQlInputException(__($exception->getMessage()));
86+
}
87+
8388
$cartData = $this->extractDataFromCart->execute($cart);
8489

8590
return [

0 commit comments

Comments
 (0)