Skip to content

Commit

Permalink
Catch throwables in mview updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Farizon committed Jul 15, 2019
1 parent 5a17bf3 commit 7ffb199
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/internal/Magento/Framework/Mview/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 7ffb199

Please sign in to comment.