Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Remove try-catch construction
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
TomashKhamlai committed Oct 11, 2019
1 parent 0714971 commit 7dc9e64
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ public function execute(array $cartItemData): array

if (isset($cartItemData['data']) && isset($cartItemData['data']['sku'])) {
$sku = $cartItemData['data']['sku'];

try {
$product = $this->productRepository->get($sku);
} catch (NoSuchEntityException $e) {
throw new GraphQlNoSuchEntityException(__('Could not find specified product.'));
}
$product = $this->productRepository->get($sku);

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

0 comments on commit 7dc9e64

Please sign in to comment.