From b6602f1d0dd7c69d696e20ae3e9add583c83407c Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 4 Oct 2010 00:07:37 -0400 Subject: [PATCH] Converting more stderr() use into exceptions. --- cake/console/shell_dispatcher.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/cake/console/shell_dispatcher.php b/cake/console/shell_dispatcher.php index 0fce9ad23b6..bf73e91755b 100644 --- a/cake/console/shell_dispatcher.php +++ b/cake/console/shell_dispatcher.php @@ -180,19 +180,16 @@ protected function _initEnvironment() { $this->stderr = new ConsoleOutput('php://stderr'); if (!$this->__bootstrap()) { - $this->stderr("\nCakePHP Console: "); - $this->stderr("\nUnable to load Cake core:"); - $this->stderr("\tMake sure " . DS . 'cake' . DS . 'libs exists in ' . CAKE_CORE_INCLUDE_PATH); - $this->_stop(); + $message = "Unable to load CakePHP core.\nMake sure " . DS . 'cake' . DS . 'libs exists in ' . CAKE_CORE_INCLUDE_PATH; + throw new RuntimeException($message); } if (!isset($this->args[0]) || !isset($this->params['working'])) { - $this->stderr("\nCakePHP Console: "); - $this->stderr('This file has been loaded incorrectly and cannot continue.'); - $this->stderr('Please make sure that ' . DIRECTORY_SEPARATOR . 'cake' . DIRECTORY_SEPARATOR . 'console is in your system path,'); - $this->stderr('and check the manual for the correct usage of this command.'); - $this->stderr('(http://manual.cakephp.org/)'); - $this->_stop(); + $message = "This file has been loaded incorrectly and cannot continue.\n" . + "Please make sure that " . DIRECTORY_SEPARATOR . "cake" . DIRECTORY_SEPARATOR . "console is in your system path,\n" . + "and check the cookbook for the correct usage of this command.\n" . + "(http://book.cakephp.org/)"; + throw new RuntimeException($message); } $this->shiftArgs();