diff --git a/src/Adapter/ContainerFinder.php b/src/Adapter/ContainerFinder.php index fa9de233ecfd6..f74aa69888571 100644 --- a/src/Adapter/ContainerFinder.php +++ b/src/Adapter/ContainerFinder.php @@ -75,12 +75,12 @@ public function getContainer() return $container; } - $container = CustomContainerBuilder::getContainer('front', _PS_MODE_DEV_); - - if (null !== $container) { - return $container; + try { + $container = CustomContainerBuilder::getContainer('front', _PS_MODE_DEV_); + } catch (\Exception $e) { + throw new ContainerNotFoundException('Kernel Container is not available'); } - throw new ContainerNotFoundException('Kernel Container is not available'); + return $container; } }