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
This commit is contained in:
davidpersson 2009-04-16 11:00:47 +02:00
parent 4faa9d3b21
commit 82641e535f

View file

@ -387,18 +387,20 @@ class Shell extends Object {
} }
} }
/** /**
* 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 $title Title of the error
* @param string $msg Error message * @param string $message An optional error message
* @access public * @access public
*/ */
function error($title, $msg) { function error($title, $message = null) {
$out = "$title\n"; $this->err(sprintf(__('Error: %s', true), $title));
$out .= "$msg\n";
$out .= "\n"; if (!empty($message)) {
$this->err($out); $this->err($message);
$this->_stop(); }
$this->_stop(1);
} }
/** /**
* Will check the number args matches otherwise throw an error * Will check the number args matches otherwise throw an error