From dfbe67622d56fba1d5a3d9182e48d09a97bf9c96 Mon Sep 17 00:00:00 2001 From: Kuba Turek Date: Fri, 10 Oct 2014 21:04:47 +0200 Subject: [PATCH] Throw an error in case when command returns code other than 0 --- Mage/Console.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Mage/Console.php b/Mage/Console.php index 1173354..4ba4b3a 100644 --- a/Mage/Console.php +++ b/Mage/Console.php @@ -120,7 +120,7 @@ class Console } } - + $exceptionOccured = false; // Run Command - Check if there is a Configuration Error if ($configError !== false) { self::output('' . $configError . '', 1, 2); @@ -136,7 +136,12 @@ class Console } } $exitCode = $command->run(); - + if (is_int($exitCode) && $exitCode !== 0) { + throw new Exception("Command execution failed with following exit code: $exitCode.", $exitCode); + } elseif (is_bool($exitCode) && !$exitCode) { + $exitCode = 1000; + throw new Exception("Command execution failed.", $exitCode); + } } catch (Exception $exception) { self::output('' . $exception->getMessage() . '', 1, 2); }