Replacing cakeError calls with exceptions in ConnectionManager and Model.

This commit is contained in:
mark_story 2010-08-27 23:54:22 -04:00
parent c4cb629d80
commit 0683dc43ff
2 changed files with 6 additions and 2 deletions

View file

@ -222,7 +222,7 @@ class ConnectionManager {
$this->_connectionsEnum[$name] = $this->__connectionData($config);
}
} else {
$this->cakeError('missingConnection', array(array('className' => 'ConnectionManager')));
throw new MissingConnectionException('ConnectionManager');
}
}
@ -274,3 +274,7 @@ class ConnectionManager {
}
}
}
class MissingDatabaseException extends RuntimeException {}
class MissingConnectionException extends RuntimeException {}

View file

@ -2825,7 +2825,7 @@ class Model extends Object {
}
if (empty($db) || !is_object($db)) {
return $this->cakeError('missingConnection', array(array('className' => $this->alias)));
throw new MissingConnectionException($this->useDbConfig);
}
}