stderr = fopen('php://stderr', 'w'); parent::__construct($error); } /** * Handle a exception in the console environment. * * @return void */ public static function handleException($exception) { $error = new ConsoleErrorHandler($exception); $error->render(); } /** * Do nothing, no controllers are needed in the console. * * @return void */ protected function _getController($exception) { return null; } /** * Overwrite how _cakeError behaves for console. There is no reason * to prepare urls as they are not relevant for this. * * @param $error Exception Exception being handled. * @return void */ protected function _cakeError($error) { $this->_outputMessage(''); } /** * Outputs the exception to STDERR. * * @param string $template The name of the template to render. * @return void */ public function _outputMessage($template) { $this->stderr($this->error->getMessage()); } /** * Outputs to the stderr filehandle. * * @param string $string Error text to output. */ public function stderr($string) { fwrite($this->stderr, "Error: ". $string . "\n"); } }