Browse Source

Resolve Exception namespace

euromark 12 years ago
parent
commit
e40d9bc963

+ 3 - 3
src/Core/Configure.php

@@ -17,7 +17,7 @@ namespace Cake\Core;
 use Cake\Cache\Cache;
 use Cake\Configure\ConfigEngineInterface;
 use Cake\Configure\Engine\PhpConfig;
-use Cake\Error;
+use Cake\Error\Exception;
 use Cake\Utility\Hash;
 
 /**
@@ -283,10 +283,10 @@ class Configure {
 	public static function dump($key, $config = 'default', $keys = []) {
 		$engine = static::_getEngine($config);
 		if (!$engine) {
-			throw new Error\Exception(sprintf('There is no "%s" config engine.', $config));
+			throw new Exception(sprintf('There is no "%s" config engine.', $config));
 		}
 		if (!method_exists($engine, 'dump')) {
-			throw new Error\Exception(sprintf('The "%s" config engine, does not have a dump() method.', $config));
+			throw new Exception(sprintf('The "%s" config engine, does not have a dump() method.', $config));
 		}
 		$values = static::$_values;
 		if (!empty($keys) && is_array($keys)) {

+ 3 - 3
src/Core/InstanceConfigTrait.php

@@ -14,7 +14,7 @@
  */
 namespace Cake\Core;
 
-use Cake\Error;
+use Cake\Error\Exception;
 use Cake\Utility\Hash;
 
 /**
@@ -156,7 +156,7 @@ trait InstanceConfigTrait {
 
 		foreach ($stack as $k) {
 			if (!is_array($update)) {
-				throw new Error\Exception(sprintf('Cannot set %s value', $key));
+				throw new Exception(sprintf('Cannot set %s value', $key));
 			}
 
 			if (!isset($update[$k])) {
@@ -188,7 +188,7 @@ trait InstanceConfigTrait {
 
 		foreach ($stack as $i => $k) {
 			if (!is_array($update)) {
-				throw new Error\Exception(sprintf('Cannot unset %s value', $key));
+				throw new Exception(sprintf('Cannot unset %s value', $key));
 			}
 
 			if (!isset($update[$k])) {

+ 2 - 2
src/Core/StaticConfigTrait.php

@@ -14,7 +14,7 @@
  */
 namespace Cake\Core;
 
-use Cake\Error;
+use Cake\Error\Exception;
 
 /**
  * A trait that provides a set of static methods to manage configuration
@@ -79,7 +79,7 @@ trait StaticConfigTrait {
 			return;
 		}
 		if (isset(static::$_config[$key])) {
-			throw new Error\Exception(sprintf('Cannot reconfigure existing key "%s"', $key));
+			throw new Exception(sprintf('Cannot reconfigure existing key "%s"', $key));
 		}
 		if (is_object($config)) {
 			$config = ['className' => $config];

+ 2 - 2
src/I18n/I18n.php

@@ -20,7 +20,7 @@ use Cake\Cache\Cache;
 use Cake\Core\App;
 use Cake\Core\Configure;
 use Cake\Core\Plugin;
-use Cake\Error;
+use Cake\Error\Exception;
 use Cake\Network\Request;
 use Cake\Network\Session;
 use Cake\Utility\Hash;
@@ -239,7 +239,7 @@ class I18n {
 			$domain = static::$defaultDomain;
 		}
 		if ($domain === '') {
-			throw new Error\Exception('You cannot use "" as a domain.');
+			throw new Exception('You cannot use "" as a domain.');
 		}
 
 		$_this->domain = $domain . '_' . $_this->l10n->lang;

+ 2 - 2
src/Utility/Debugger.php

@@ -15,7 +15,7 @@
 namespace Cake\Utility;
 
 use Cake\Core\Configure;
-use Cake\Error;
+use Cake\Error\Exception;
 use Cake\Log\Log;
 
 /**
@@ -627,7 +627,7 @@ class Debugger {
 			return $self->_outputFormat;
 		}
 		if ($format !== false && !isset($self->_templates[$format])) {
-			throw new Error\Exception('Invalid Debugger output format.');
+			throw new Exception('Invalid Debugger output format.');
 		}
 		$self->_outputFormat = $format;
 	}

+ 2 - 2
src/Utility/Number.php

@@ -18,7 +18,7 @@
  */
 namespace Cake\Utility;
 
-use Cake\Error;
+use Cake\Error\Exception;
 
 /**
  * Number helper library.
@@ -161,7 +161,7 @@ class Number {
 		if ($default !== false) {
 			return $default;
 		}
-		throw new Error\Exception('No unit type.');
+		throw new Exception('No unit type.');
 	}
 
 /**

+ 8 - 8
src/Utility/Security.php

@@ -17,7 +17,7 @@
 namespace Cake\Utility;
 
 use Cake\Core\Configure;
-use Cake\Error;
+use Cake\Error\Exception;
 
 /**
  * Security Library contains utility methods related to security
@@ -139,7 +139,7 @@ class Security {
  */
 	public static function setCost($cost) {
 		if ($cost < 4 || $cost > 31) {
-			throw new Error\Exception(vsprintf(
+			throw new Exception(vsprintf(
 				'Invalid value, cost must be between %s and %s',
 				array(4, 31)
 			));
@@ -158,13 +158,13 @@ class Security {
  */
 	public static function rijndael($text, $key, $operation) {
 		if (empty($key)) {
-			throw new Error\Exception('You cannot use an empty key for Security::rijndael()');
+			throw new Exception('You cannot use an empty key for Security::rijndael()');
 		}
 		if (empty($operation) || !in_array($operation, array('encrypt', 'decrypt'))) {
-			throw new Error\Exception('You must specify the operation for Security::rijndael(), either encrypt or decrypt');
+			throw new Exception('You must specify the operation for Security::rijndael(), either encrypt or decrypt');
 		}
 		if (strlen($key) < 32) {
-			throw new Error\Exception('You must use a key larger than 32 bytes for Security::rijndael()');
+			throw new Exception('You must use a key larger than 32 bytes for Security::rijndael()');
 		}
 		$algorithm = MCRYPT_RIJNDAEL_256;
 		$mode = MCRYPT_MODE_CBC;
@@ -213,7 +213,7 @@ class Security {
 		}
 
 		if ($salt === true || strpos($salt, '$2y$') !== 0 || strlen($salt) < 29) {
-			throw new Error\Exception(sprintf(
+			throw new Exception(sprintf(
 				'Invalid salt: %s for blowfish Please visit http://www.php.net/crypt and read the appropriate section for building blowfish salts.',
 				$salt
 			));
@@ -264,7 +264,7 @@ class Security {
  */
 	protected static function _checkKey($key, $method) {
 		if (strlen($key) < 32) {
-			throw new Error\Exception(sprintf('Invalid key for %s, key must be at least 256 bits (32 bytes) long.', $method));
+			throw new Exception(sprintf('Invalid key for %s, key must be at least 256 bits (32 bytes) long.', $method));
 		}
 	}
 
@@ -280,7 +280,7 @@ class Security {
 	public static function decrypt($cipher, $key, $hmacSalt = null) {
 		self::_checkKey($key, 'decrypt()');
 		if (empty($cipher)) {
-			throw new Error\Exception('The data to decrypt cannot be empty.');
+			throw new Exception('The data to decrypt cannot be empty.');
 		}
 		if ($hmacSalt === null) {
 			$hmacSalt = Configure::read('Security.salt');