Skip to content
Permalink
Browse files

Model\Error -> Model\Exception

  • Loading branch information...
lorenzo committed Aug 30, 2014
1 parent 3f6ffe3 commit a5571df1284503ffabd772f2abbc5bf4cbb79ffe
@@ -12,7 +12,7 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Model\Error;
namespace Cake\Model\Exception;
use Cake\Core\Exception\Exception;
@@ -14,7 +14,8 @@
*/
namespace Cake\Model;
use Cake\Core\Exception\Exception;
use Cake\Model\Exception\MissingModelException;
use InvalidArgumentException;
/**
* Provides functionality for loading table classes
@@ -71,8 +72,8 @@ protected function _setModelClass($name) {
* @param string $type The type of repository to load. Defaults to 'Table' which
* delegates to Cake\ORM\TableRegistry.
* @return bool True when single repository found and instance created.
* @throws \Cake\Model\Error\MissingModelException If the model class cannot be found.
* @throws \Cake\Core\Exception\Exception When using a type that has not been registered.
* @throws \Cake\Model\Exception\MissingModelException If the model class cannot be found.
* @throws \InvalidArgumentException When using a type that has not been registered.
*/
public function loadModel($modelClass = null, $type = 'Table') {
if ($modelClass === null) {
@@ -86,15 +87,15 @@ public function loadModel($modelClass = null, $type = 'Table') {
list($plugin, $modelClass) = pluginSplit($modelClass, true);
if (!isset($this->_modelFactories[$type])) {
throw new Exception(sprintf(
throw new InvalidArgumentException(sprintf(
'Unknown repository type "%s". Make sure you register a type before trying to use it.',
$type
));
}
$factory = $this->_modelFactories[$type];
$this->{$modelClass} = $factory($plugin . $modelClass);
if (!$this->{$modelClass}) {
throw new Error\MissingModelException([$modelClass, $type]);
throw new MissingModelException([$modelClass, $type]);
}
return true;
}
@@ -89,7 +89,7 @@ public function testModelFactory() {
* test MissingModelException being thrown
*
* @return void
* @expectedException Cake\Model\Error\MissingModelException
* @expectedException Cake\Model\Exception\MissingModelException
* @expectedExceptionMessage Model class "Magic" of type "Test" could not be found.
*/
public function testMissingModelException() {

0 comments on commit a5571df

Please sign in to comment.
You can’t perform that action at this time.