From c18602c3c2924175e8d2f0a8f147854781b40529 Mon Sep 17 00:00:00 2001 From: Pablo Ivulic Date: Tue, 13 Dec 2016 14:55:36 +0100 Subject: [PATCH 1/2] Throw exception if errors are found --- .../src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php index b6196c45f4e06..e914301f10ab7 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php @@ -70,6 +70,7 @@ public function write(array $data) if ($errorsCount) { $this->console->writeln('' . 'Total Errors Count: ' . $errorsCount . ''); + throw new \Magento\Framework\Validator\Exception(__('Error durring compilation')); } } From 658a30a42046bc21abb7d61e700be566e06d61e1 Mon Sep 17 00:00:00 2001 From: Pablo Ivulic Date: Thu, 13 Apr 2017 13:03:47 +0200 Subject: [PATCH 2/2] Moved exception to be thrown one level up --- setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php | 4 ++++ .../Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php index 9dff437500e57..de1c8c9fd99d8 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php @@ -81,11 +81,15 @@ public function add($type, $key, $message = '') * Write entries * * @return void + * @throws \Magento\Framework\Validator\Exception */ public function report() { $this->_successWriter->write($this->_successEntries); $this->_errorWriter->write($this->_errorEntries); + if (count($this->_errorEntries) > 0) { + throw new \Magento\Framework\Validator\Exception(__('Error during compilation')); + } } /** diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php index e914301f10ab7..b6196c45f4e06 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php @@ -70,7 +70,6 @@ public function write(array $data) if ($errorsCount) { $this->console->writeln('' . 'Total Errors Count: ' . $errorsCount . ''); - throw new \Magento\Framework\Validator\Exception(__('Error durring compilation')); } }