Skip to content

Commit 9c31b5e

Browse files
authored
ENGCOM-4021: Added original exception as the cause to the new exception on product delete error #20578
2 parents 58cd676 + 3691214 commit 9c31b5e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,11 @@ public function delete(ProductInterface $product)
644644
unset($this->instancesById[$product->getId()]);
645645
$this->resourceModel->delete($product);
646646
} catch (ValidatorException $e) {
647-
throw new CouldNotSaveException(__($e->getMessage()));
647+
throw new CouldNotSaveException(__($e->getMessage()), $e);
648648
} catch (\Exception $e) {
649649
throw new \Magento\Framework\Exception\StateException(
650-
__('The "%1" product couldn\'t be removed.', $sku)
650+
__('The "%1" product couldn\'t be removed.', $sku),
651+
$e
651652
);
652653
}
653654
$this->removeProductFromLocalCache($sku);

0 commit comments

Comments
 (0)