Adding non-zero exit codes to ErrorHandler in the console. Fixes #1468

This commit is contained in:
mark_story 2011-01-18 19:40:31 -05:00
parent ab337e2e8a
commit a0a87ade5a

View file

@ -63,7 +63,7 @@ class ErrorHandler extends Object {
function error($params) { function error($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr($code . $name . $message."\n"); $this->stderr($code . $name . $message."\n");
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -79,7 +79,7 @@ class ErrorHandler extends Object {
'name' => 'Not found', 'name' => 'Not found',
'message' => sprintf(__("The requested address %s was not found on this server.", true), $url, $message) 'message' => sprintf(__("The requested address %s was not found on this server.", true), $url, $message)
)); ));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -92,7 +92,7 @@ class ErrorHandler extends Object {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$controllerName = str_replace('Controller', '', $className); $controllerName = str_replace('Controller', '', $className);
$this->stderr(sprintf(__("Missing Controller '%s'", true), $controllerName)); $this->stderr(sprintf(__("Missing Controller '%s'", true), $controllerName));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -104,7 +104,7 @@ class ErrorHandler extends Object {
function missingAction($params) { function missingAction($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Method '%s' in '%s'", true), $action, $className)); $this->stderr(sprintf(__("Missing Method '%s' in '%s'", true), $action, $className));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -116,7 +116,7 @@ class ErrorHandler extends Object {
function privateAction($params) { function privateAction($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Trying to access private method '%s' in '%s'", true), $action, $className)); $this->stderr(sprintf(__("Trying to access private method '%s' in '%s'", true), $action, $className));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -128,7 +128,7 @@ class ErrorHandler extends Object {
function missingTable($params) { function missingTable($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing database table '%s' for model '%s'", true), $table, $className)); $this->stderr(sprintf(__("Missing database table '%s' for model '%s'", true), $table, $className));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -139,7 +139,7 @@ class ErrorHandler extends Object {
*/ */
function missingDatabase($params = array()) { function missingDatabase($params = array()) {
$this->stderr(__("Missing Database", true)); $this->stderr(__("Missing Database", true));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -151,7 +151,7 @@ class ErrorHandler extends Object {
function missingView($params) { function missingView($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing View '%s' for '%s' in '%s'", true), $file, $action, $className)); $this->stderr(sprintf(__("Missing View '%s' for '%s' in '%s'", true), $file, $action, $className));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -163,7 +163,7 @@ class ErrorHandler extends Object {
function missingLayout($params) { function missingLayout($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Layout '%s'", true), $file)); $this->stderr(sprintf(__("Missing Layout '%s'", true), $file));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -175,7 +175,7 @@ class ErrorHandler extends Object {
function missingConnection($params) { function missingConnection($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(__("Missing Database Connection. Try 'cake bake'", true)); $this->stderr(__("Missing Database Connection. Try 'cake bake'", true));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -187,7 +187,7 @@ class ErrorHandler extends Object {
function missingHelperFile($params) { function missingHelperFile($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Helper file '%s' for '%s'", true), $file, Inflector::camelize($helper))); $this->stderr(sprintf(__("Missing Helper file '%s' for '%s'", true), $file, Inflector::camelize($helper)));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -199,7 +199,7 @@ class ErrorHandler extends Object {
function missingHelperClass($params) { function missingHelperClass($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Helper class '%s' in '%s'", true), Inflector::camelize($helper), $file)); $this->stderr(sprintf(__("Missing Helper class '%s' in '%s'", true), Inflector::camelize($helper), $file));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -211,7 +211,7 @@ class ErrorHandler extends Object {
function missingComponentFile($params) { function missingComponentFile($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Component file '%s' for '%s'", true), $file, Inflector::camelize($component))); $this->stderr(sprintf(__("Missing Component file '%s' for '%s'", true), $file, Inflector::camelize($component)));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -223,7 +223,7 @@ class ErrorHandler extends Object {
function missingComponentClass($params) { function missingComponentClass($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Component class '%s' in '%s'", true), Inflector::camelize($component), $file)); $this->stderr(sprintf(__("Missing Component class '%s' in '%s'", true), Inflector::camelize($component), $file));
$this->_stop(); $this->_stop(1);
} }
/** /**
@ -235,7 +235,7 @@ class ErrorHandler extends Object {
function missingModel($params) { function missingModel($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing model '%s'", true), $className)); $this->stderr(sprintf(__("Missing model '%s'", true), $className));
$this->_stop(); $this->_stop(1);
} }
/** /**