Skip to content

Commit d12b1b4

Browse files
committed
Moving Cake\Error\Exception to Cake\Core\Error
1 parent ce94b81 commit d12b1b4

File tree

114 files changed

+213
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+213
-211
lines changed

src/Auth/BaseAuthorize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ abstract public function authorize($user, Request $request);
9494
*
9595
* @param Controller $controller null to get, a controller to set.
9696
* @return mixed
97-
* @throws \Cake\Error\Exception
97+
* @throws \Cake\Core\Error\Exception
9898
*/
9999
public function controller(Controller $controller = null) {
100100
if ($controller) {

src/Auth/ControllerAuthorize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ControllerAuthorize extends BaseAuthorize {
4343
*
4444
* @param Controller $controller null to get, a controller to set.
4545
* @return mixed
46-
* @throws \Cake\Error\Exception
46+
* @throws \Cake\Core\Error\Exception
4747
*/
4848
public function controller(Controller $controller = null) {
4949
if ($controller) {

src/Cache/Cache.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* @param string $name Name of the configuration
6262
* @param array $config Optional associative array of settings passed to the engine
6363
* @return array [engine, settings] on success, false on failure
64-
* @throws \Cake\Error\Exception
64+
* @throws \Cake\Core\Error\Exception
6565
*/
6666
class Cache {
6767

@@ -213,7 +213,7 @@ public static function write($key, $value, $config = 'default') {
213213
* @param array $data An array of data to be stored in the cache
214214
* @param string $config Optional string configuration name to write to. Defaults to 'default'
215215
* @return array of bools for each key provided, indicating true for success or false for fail
216-
* @throws \Cake\Error\Exception
216+
* @throws \Cake\Core\Error\Exception
217217
*/
218218
public static function writeMany($data, $config = 'default') {
219219
$engine = static::engine($config);
@@ -394,7 +394,7 @@ public static function clearGroup($group, $config = 'default') {
394394
*
395395
* @param string $group group name or null to retrieve all group mappings
396396
* @return array map of group and all configuration that has the same group
397-
* @throws \Cake\Error\Exception
397+
* @throws \Cake\Core\Error\Exception
398398
*/
399399
public static function groupConfigs($group = null) {
400400
if ($group === null) {

src/Cache/CacheRegistry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function _resolveClassName($class) {
4848
* @param string $class The classname that is missing.
4949
* @param string $plugin The plugin the cache is missing in.
5050
* @return void
51-
* @throws \Cake\Error\Exception
51+
* @throws \Cake\Core\Error\Exception
5252
*/
5353
protected function _throwMissingClassError($class, $plugin) {
5454
throw new Error\Exception(sprintf('Cache engine %s is not available.', $class));
@@ -63,7 +63,7 @@ protected function _throwMissingClassError($class, $plugin) {
6363
* @param string $alias The alias of the object.
6464
* @param array $config An array of settings to use for the cache engine.
6565
* @return CacheEngine The constructed CacheEngine class.
66-
* @throws \Cake\Error\Exception when an object doesn't implement
66+
* @throws \Cake\Core\Error\Exception when an object doesn't implement
6767
* the correct interface.
6868
*/
6969
protected function _create($class, $alias, $config) {

src/Cache/Engine/FileEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ protected function _clearDirectory($path, $now, $threshold) {
320320
* @param string $key The key to decrement
321321
* @param int $offset The number to offset
322322
* @return void
323-
* @throws \Cake\Error\Exception
323+
* @throws \Cake\Core\Error\Exception
324324
*/
325325
public function decrement($key, $offset = 1) {
326326
throw new Error\Exception('Files cannot be atomically decremented.');
@@ -332,7 +332,7 @@ public function decrement($key, $offset = 1) {
332332
* @param string $key The key to decrement
333333
* @param int $offset The number to offset
334334
* @return void
335-
* @throws \Cake\Error\Exception
335+
* @throws \Cake\Core\Error\Exception
336336
*/
337337
public function increment($key, $offset = 1) {
338338
throw new Error\Exception('Files cannot be atomically incremented.');

src/Cache/Engine/MemcachedEngine.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class MemcachedEngine extends CacheEngine {
9494
*
9595
* @param array $config array of setting for the engine
9696
* @return bool True if the engine has been successfully initialized, false if not
97-
* @throws \Cake\Error\Exception when you try use authentication without Memcached compiled with SASL support
97+
* @throws \Cake\Core\Error\Exception when you try use authentication without Memcached compiled with SASL support
9898
*/
9999
public function init(array $config = []) {
100100
if (!class_exists('Memcached')) {
@@ -166,7 +166,7 @@ public function init(array $config = []) {
166166
* Settings the memcached instance
167167
*
168168
* @return void
169-
* @throws \Cake\Error\Exception when the Memcached extension is not built with the desired serializer engine
169+
* @throws \Cake\Core\Error\Exception when the Memcached extension is not built with the desired serializer engine
170170
*/
171171
protected function _setOptions() {
172172
$this->_Memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
@@ -303,7 +303,7 @@ public function readMany($keys) {
303303
* @param string $key Identifier for the data
304304
* @param int $offset How much to increment
305305
* @return bool|int New incremented value, false otherwise
306-
* @throws \Cake\Error\Exception when you try to increment with compress = true
306+
* @throws \Cake\Core\Error\Exception when you try to increment with compress = true
307307
*/
308308
public function increment($key, $offset = 1) {
309309
$key = $this->_key($key);
@@ -317,7 +317,7 @@ public function increment($key, $offset = 1) {
317317
* @param string $key Identifier for the data
318318
* @param int $offset How much to subtract
319319
* @return bool|int New decremented value, false otherwise
320-
* @throws \Cake\Error\Exception when you try to decrement with compress = true
320+
* @throws \Cake\Core\Error\Exception when you try to decrement with compress = true
321321
*/
322322
public function decrement($key, $offset = 1) {
323323
$key = $this->_key($key);

src/Configure/Engine/IniConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function __construct($path = null, $section = null) {
9292
* @param string $key The identifier to read from. If the key has a . it will be treated
9393
* as a plugin prefix. The chosen file must be on the engine's path.
9494
* @return array Parsed configuration values.
95-
* @throws \Cake\Error\Exception when files don't exist.
95+
* @throws \Cake\Core\Error\Exception when files don't exist.
9696
* Or when files contain '..' as this could lead to abusive reads.
9797
*/
9898
public function read($key) {

src/Configure/Engine/PhpConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct($path = null) {
5555
* @param string $key The identifier to read from. If the key has a . it will be treated
5656
* as a plugin prefix.
5757
* @return array Parsed configuration values.
58-
* @throws \Cake\Error\Exception when files don't exist or they don't contain `$config`.
58+
* @throws \Cake\Core\Error\Exception when files don't exist or they don't contain `$config`.
5959
* Or when files contain '..' as this could lead to abusive reads.
6060
*/
6161
public function read($key) {

src/Console/Error/ConsoleException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
namespace Cake\Console\Error;
1515

16-
use Cake\Error\Exception;
16+
use Cake\Core\Error\Exception;
1717

1818
/**
1919
* Exception class for Console libraries. This exception will be thrown from Console library

src/Console/Error/MissingShellException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
namespace Cake\Console\Error;
1515

16-
use Cake\Error\Exception;
16+
use Cake\Core\Error\Exception;
1717

1818
/**
1919
* Used when a shell cannot be found.

src/Console/Error/MissingShellMethodException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
namespace Cake\Console\Error;
1515

16-
use Cake\Error\Exception;
16+
use Cake\Core\Error\Exception;
1717

1818
/**
1919
* Used when a shell method cannot be found.

src/Console/Error/MissingTaskException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
namespace Cake\Console\Error;
1515

16-
use Cake\Error\Exception;
16+
use Cake\Core\Error\Exception;
1717

1818
/**
1919
* Used when a Task cannot be found.

src/Console/ShellDispatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use Cake\Core\App;
1818
use Cake\Core\Configure;
19-
use Cake\Error\Exception;
19+
use Cake\Core\Error\Exception;
2020
use Cake\Utility\Inflector;
2121

2222
/**
@@ -100,7 +100,7 @@ public static function run($argv) {
100100
* Defines current working environment.
101101
*
102102
* @return void
103-
* @throws \Cake\Error\Exception
103+
* @throws \Cake\Core\Error\Exception
104104
*/
105105
protected function _initEnvironment() {
106106
if (!$this->_bootstrap()) {

src/Controller/Component/AuthComponent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ public function isAuthorized($user = null, Request $request = null) {
483483
* Loads the authorization objects configured.
484484
*
485485
* @return mixed Either null when authorize is empty, or the loaded authorization objects.
486-
* @throws \Cake\Error\Exception
486+
* @throws \Cake\Core\Error\Exception
487487
*/
488488
public function constructAuthorize() {
489489
if (empty($this->_config['authorize'])) {
@@ -741,7 +741,7 @@ public function identify() {
741741
* Loads the configured authentication objects.
742742
*
743743
* @return mixed either null on empty authenticate value, or an array of loaded objects.
744-
* @throws \Cake\Error\Exception
744+
* @throws \Cake\Core\Error\Exception
745745
*/
746746
public function constructAuthenticate() {
747747
if (empty($this->_config['authenticate'])) {

src/Controller/Component/RequestHandlerComponent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Cake\Controller\Controller;
2020
use Cake\Core\App;
2121
use Cake\Core\Configure;
22-
use Cake\Error\Exception;
22+
use Cake\Core\Error\Exception;
2323
use Cake\Event\Event;
2424
use Cake\Network\Response;
2525
use Cake\Routing\Router;
@@ -636,7 +636,7 @@ public function mapAlias($alias) {
636636
* be the handling callback, all other arguments should be additional parameters
637637
* for the handler.
638638
* @return void
639-
* @throws \Cake\Error\Exception
639+
* @throws \Cake\Core\Error\Exception
640640
*/
641641
public function addInputType($type, $handler) {
642642
if (!is_array($handler) || !isset($handler[0]) || !is_callable($handler[0])) {

src/Controller/Controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
namespace Cake\Controller;
1616

17-
use Cake\Error\Exception;
17+
use Cake\Core\Error\Exception;
1818
use Cake\Event\Event;
1919
use Cake\Event\EventListener;
2020
use Cake\Event\EventManagerTrait;
@@ -350,7 +350,7 @@ public function setRequest(Request $request) {
350350
* exists and isn't private.
351351
*
352352
* @return mixed The resulting response.
353-
* @throws \Cake\Error\Exception When request is not set.
353+
* @throws \Cake\Core\Error\Exception When request is not set.
354354
* @throws \Cake\Controller\Error\PrivateActionException When actions are not public or prefixed by _
355355
* @throws \Cake\Controller\Error\MissingActionException When actions are not defined.
356356
*/

src/Controller/Error/MissingActionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
namespace Cake\Controller\Error;
1515

16-
use Cake\Error\Exception;
16+
use Cake\Core\Error\Exception;
1717

1818
/**
1919
* Missing Action exception - used when a controller action

src/Controller/Error/MissingComponentException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
namespace Cake\Controller\Error;
1515

16-
use Cake\Error\Exception;
16+
use Cake\Core\Error\Exception;
1717

1818
/**
1919
* Used when a component cannot be found.

src/Controller/Error/MissingControllerException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
namespace Cake\Controller\Error;
1515

16-
use Cake\Error\Exception;
16+
use Cake\Core\Error\Exception;
1717

1818
/**
1919
* Missing Controller exception - used when a controller

src/Controller/Error/PrivateActionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
namespace Cake\Controller\Error;
1717

18-
use Cake\Error\Exception;
18+
use Cake\Core\Error\Exception;
1919

2020
/**
2121
* Private Action exception - used when a controller action

src/Core/Configure.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Cake\Cache\Cache;
1818
use Cake\Configure\ConfigEngineInterface;
1919
use Cake\Configure\Engine\PhpConfig;
20-
use Cake\Error\Exception;
20+
use Cake\Core\Error\Exception;
2121
use Cake\Utility\Hash;
2222

2323
/**
@@ -281,7 +281,7 @@ public static function load($key, $config = 'default', $merge = true) {
281281
* @param array $keys The name of the top-level keys you want to dump.
282282
* This allows you save only some data stored in Configure.
283283
* @return bool success
284-
* @throws \Cake\Error\Exception if the adapter does not implement a `dump` method.
284+
* @throws \Cake\Core\Error\Exception if the adapter does not implement a `dump` method.
285285
*/
286286
public static function dump($key, $config = 'default', $keys = []) {
287287
$engine = static::_getEngine($config);

src/Error/Exception.php renamed to src/Core/Error/Exception.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @since 3.0.0
1212
* @license http://www.opensource.org/licenses/mit-license.php MIT License
1313
*/
14-
namespace Cake\Error;
14+
namespace Cake\Core\Error;
1515

1616
/**
1717
* Base class that all CakePHP Exceptions extend.
@@ -51,12 +51,12 @@ class Exception extends \RuntimeException {
5151
* that are made available in the view, and sprintf()'d into Exception::$_messageTemplate
5252
* @param int $code The code of the error, is also the HTTP status code for the error.
5353
*/
54-
public function __construct($message, $code = 500) {
54+
public function __construct($message, $code = 500, $previous = null) {
5555
if (is_array($message)) {
5656
$this->_attributes = $message;
5757
$message = vsprintf($this->_messageTemplate, $message);
5858
}
59-
parent::__construct($message, $code);
59+
parent::__construct($message, $code, $previous);
6060
}
6161

6262
/**

src/Core/Error/MissingPluginException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
namespace Cake\Core\Error;
1515

16-
use Cake\Error\Exception;
16+
use Exception;
1717

1818
/**
1919
* Exception raised when a plugin could not be found

src/Core/InstanceConfigTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
namespace Cake\Core;
1616

17-
use Cake\Error\Exception;
17+
use Cake\Core\Error\Exception;
1818
use Cake\Utility\Hash;
1919

2020
/**
@@ -69,7 +69,7 @@ trait InstanceConfigTrait {
6969
* @param mixed|null $value The value to set.
7070
* @param bool $merge Whether to merge or overwrite existing config, defaults to true.
7171
* @return mixed Config value being read, or the object itself on write operations.
72-
* @throws \Cake\Error\Exception When trying to set a key that is invalid.
72+
* @throws \Cake\Core\Error\Exception When trying to set a key that is invalid.
7373
*/
7474
public function config($key = null, $value = null, $merge = true) {
7575
if (!$this->_configInitialized) {
@@ -122,7 +122,7 @@ protected function _configRead($key) {
122122
* @param mixed $value Value to write.
123123
* @param bool $merge Whether to merge or overwrite value.
124124
* @return void
125-
* @throws Cake\Error\Exception if attempting to clobber existing config
125+
* @throws Cake\Core\Error\Exception if attempting to clobber existing config
126126
*/
127127
protected function _configWrite($key, $value, $merge = false) {
128128
if (is_string($key) && $value === null) {
@@ -174,7 +174,7 @@ protected function _configWrite($key, $value, $merge = false) {
174174
*
175175
* @param string $key Key to delete.
176176
* @return void
177-
* @throws Cake\Error\Exception if attempting to clobber existing config
177+
* @throws Cake\Core\Error\Exception if attempting to clobber existing config
178178
*/
179179
protected function _configDelete($key) {
180180
if (strpos($key, '.') === false) {

src/Core/StaticConfigTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
namespace Cake\Core;
1616

17-
use Cake\Error\Exception;
17+
use Cake\Core\Error\Exception;
1818

1919
/**
2020
* A trait that provides a set of static methods to manage configuration
@@ -65,7 +65,7 @@ trait StaticConfigTrait {
6565
* @param string|array $key The name of the configuration, or an array of multiple configs.
6666
* @param array $config An array of name => configuration data for adapter.
6767
* @return mixed null when adding configuration and an array of configuration data when reading.
68-
* @throws \Cake\Error\Exception When trying to modify an existing config.
68+
* @throws \Cake\Core\Error\Exception When trying to modify an existing config.
6969
*/
7070
public static function config($key, $config = null) {
7171
// Read config.

src/Database/Error/MissingConnectionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
namespace Cake\Database\Error;
1616

17-
use Cake\Error\Exception;
17+
use Cake\Core\Error\Exception;
1818

1919
class MissingConnectionException extends Exception {
2020

0 commit comments

Comments
 (0)