From 82641e535f581260c7b614aa3ac56d0349de2c49 Mon Sep 17 00:00:00 2001 From: davidpersson Date: Thu, 16 Apr 2009 11:00:47 +0200 Subject: [PATCH] Updating formatting of output in Shell:error Renaming $msg param to $message The $message param is now optional The method now exits the app with status code 1 --- cake/console/libs/shell.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cake/console/libs/shell.php b/cake/console/libs/shell.php index b298fcaaa4d..01855bcebe3 100644 --- a/cake/console/libs/shell.php +++ b/cake/console/libs/shell.php @@ -387,18 +387,20 @@ function hr($newline = false) { } } /** - * Displays a formatted error message and exits the application + * Displays a formatted error message + * and exits the application with status code 1 * - * @param string $title Title of the error message - * @param string $msg Error message + * @param string $title Title of the error + * @param string $message An optional error message * @access public */ - function error($title, $msg) { - $out = "$title\n"; - $out .= "$msg\n"; - $out .= "\n"; - $this->err($out); - $this->_stop(); + function error($title, $message = null) { + $this->err(sprintf(__('Error: %s', true), $title)); + + if (!empty($message)) { + $this->err($message); + } + $this->_stop(1); } /** * Will check the number args matches otherwise throw an error