Skip to content

Commit

Permalink
Add exception handling for setAreaCode call
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbojanowski committed Feb 1, 2020
1 parent d9e86b6 commit 01ed9d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Model/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,10 @@ public function executeImmediate($jobname) {
$scheduled = $this->resource->saveSchedule($jobconfig, time(), $schedule);

$state = ObjectManager::getInstance()->get("Magento\Framework\App\State");
$state->setAreaCode("crontab");
try {
$state->setAreaCode("crontab");
} catch (\Exception $e) {
}
$areaList = ObjectManager::getInstance()->get(AreaList::class);
$areaList->getArea(Area::AREA_CRONTAB)->load(Area::PART_TRANSLATE);

Expand Down

0 comments on commit 01ed9d9

Please sign in to comment.