Skip to content

Commit 7dc9e64

Browse files
committed
Remove try-catch construction
As long as ```graphql type Mutation { addDownloadableProductsToCart(input: AddDownloadableProductsToCartInput): AddDownloadableProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") } ``` is not changed, this exception caching is a duplicate of one that is in \Magento\QuoteGraphQl\Model\Resolver\AddSimpleProductsToCart::execute(); Signed-off-by: Tomash Khamlai <tomash.khamlai@gmail.com>
1 parent 0714971 commit 7dc9e64

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

app/code/Magento/DownloadableGraphQl/Model/Cart/BuyRequest/DownloadableLinksDataProvider.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ public function execute(array $cartItemData): array
4040

4141
if (isset($cartItemData['data']) && isset($cartItemData['data']['sku'])) {
4242
$sku = $cartItemData['data']['sku'];
43-
44-
try {
45-
$product = $this->productRepository->get($sku);
46-
} catch (NoSuchEntityException $e) {
47-
throw new GraphQlNoSuchEntityException(__('Could not find specified product.'));
48-
}
43+
$product = $this->productRepository->get($sku);
4944

5045
if ($product->getLinksPurchasedSeparately() && isset($cartItemData['downloadable_product_links'])) {
5146
$downloadableLinks = $cartItemData['downloadable_product_links'];

0 commit comments

Comments
 (0)