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

Commit

Permalink
ENGCOM-6064: Remove try-catch construction #1002
Browse files Browse the repository at this point in the history
  • Loading branch information
lenaorobei authored Oct 14, 2019
2 parents ec3db73 + da9006b commit de81a7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 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
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ public function testAddNonExistentConfigurableProductVariationToCart()

$this->expectException(\Exception::class);
$this->expectExceptionMessage(
'Could not add the product with SKU configurable to the shopping cart: Could not find specified product.'
'Could not add the product with SKU configurable to the shopping cart: The product that was requested ' .
'doesn\'t exist. Verify the product and try again.'
);

$this->graphQlMutation($query);
Expand Down

0 comments on commit de81a7f

Please sign in to comment.