Skip to content

Commit

Permalink
Including missing file and improving consistency when throwing
Browse files Browse the repository at this point in the history
exceptions
  • Loading branch information
lorenzo committed Dec 21, 2013
1 parent a814d6a commit 28eaab1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions Cake/ORM/Error/RecordNotFoundException.php
@@ -0,0 +1,25 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 3.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\ORM\Error;

use Cake\Error\NotFoundException;

/**
* Exception raised when a particular record was not found
*
*/
class RecordNotFoundException extends NotFoundException {

}
3 changes: 2 additions & 1 deletion Cake/ORM/Table.php
Expand Up @@ -28,6 +28,7 @@
use Cake\ORM\BehaviorRegistry;
use Cake\ORM\Entity;
use Cake\ORM\Error\MissingEntityException;
use Cake\ORM\Error\RecordNotFoundException;
use Cake\ORM\Marshaller;
use Cake\Utility\Inflector;
use Cake\Validation\Validator;
Expand Down Expand Up @@ -816,7 +817,7 @@ public function get($primaryKey, $options = []) {
$entity = $this->find('all', $options)->where($conditions)->first();

if (!$entity) {
throw new Error\RecordNotFoundException(__d(
throw new RecordNotFoundException(__d(
'cake_dev', 'Record "%s" not found in table "%s"',
implode(',', (array)$primaryKey),
$this->alias()
Expand Down

0 comments on commit 28eaab1

Please sign in to comment.