From 0bf1040f75f061fcef6acce0c26e3ea828f9853e Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 20 Aug 2013 13:17:01 -0400 Subject: [PATCH] Clean up ShellDispatcher. It no longer needs to work around consoleHandler being undefined. If people are negligent and remove the error handling in the app/config then they should be left to their own devices. --- lib/Cake/Console/ShellDispatcher.php | 39 ++-------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index 47ad0e5cb5d..899df3b91b6 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -112,8 +112,6 @@ protected function _initEnvironment() { * @return boolean Success. */ protected function _bootstrap() { - $this->setErrorHandlers(); - if (!Configure::read('App.fullBaseUrl')) { Configure::write('App.fullBaseUrl', 'http://localhost'); } @@ -121,47 +119,14 @@ protected function _bootstrap() { return true; } -/** - * Set the error/exception handlers for the console - * - * @return void - */ - public function setErrorHandlers() { - $error = Configure::read('Error'); - $exception = Configure::read('Exception'); - - $errorHandler = new ConsoleErrorHandler(); - if (empty($error['consoleHandler'])) { - $error['consoleHandler'] = array($errorHandler, 'handleError'); - Configure::write('Error', $error); - } - if (empty($exception['consoleHandler'])) { - $exception['consoleHandler'] = array($errorHandler, 'handleException'); - Configure::write('Exception', $exception); - } - set_error_handler($error['consoleHandler'], Configure::read('Error.level')); - } - /** * Dispatches a CLI request * * @return integer The cli command exit code. 0 is success. */ public function dispatch() { - try { - $exit = 0; - $this->_dispatch(); - } catch (\Exception $e) { - $handler = Configure::read('Exception.consoleHandler'); - if (is_callable($handler)) { - $exit = call_user_func($handler, $e); - } else { - echo __d('cake_console', "An exception occured\n"); - echo __d('cake_console', "But the configured Exception.consoleHandler is not callable\n"); - echo $e->getMessage() . "\n"; - echo $e->getTraceAsString() . "\n"; - } - } + $exit = 0; + $this->_dispatch(); return $exit; }