From 7ffb199e9bbf17567ccc491ef24a7ec9c0d1ef7d Mon Sep 17 00:00:00 2001 From: Quentin Farizon Date: Tue, 4 Jun 2019 17:29:49 +0200 Subject: [PATCH] Catch throwables in mview updating --- lib/internal/Magento/Framework/Mview/View.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Mview/View.php b/lib/internal/Magento/Framework/Mview/View.php index fca827ca2505f..0e5af82a8200b 100644 --- a/lib/internal/Magento/Framework/Mview/View.php +++ b/lib/internal/Magento/Framework/Mview/View.php @@ -299,12 +299,19 @@ public function update() ? View\StateInterface::STATUS_SUSPENDED : View\StateInterface::STATUS_IDLE; $this->getState()->setVersionId($currentVersionId)->setStatus($statusToRestore)->save(); - } catch (\Exception $exception) { + } catch (\Throwable $exception) { $this->getState()->loadByView($this->getId()); $statusToRestore = $this->getState()->getStatus() == View\StateInterface::STATUS_SUSPENDED ? View\StateInterface::STATUS_SUSPENDED : View\StateInterface::STATUS_IDLE; $this->getState()->setStatus($statusToRestore)->save(); + if (!$exception instanceof \Exception) { + $exception = new \RuntimeException( + 'Error when updating an mview', + 0, + $exception + ); + } throw $exception; } }