Commit 261b71d2 authored by catch's avatar catch
Browse files

Issue #1992950 by xjm: Stop use-ing Exception.

parent b18ad406
......@@ -42,8 +42,6 @@
namespace Drupal\Component\Archiver;
use Exception;
//require_once 'PEAR.php';
//
//
......@@ -636,7 +634,7 @@ function _error($p_message)
{
// ----- To be completed
// $this->raiseError($p_message);
throw new Exception($p_message);
throw new \Exception($p_message);
}
// }}}
......@@ -645,7 +643,7 @@ function _warning($p_message)
{
// ----- To be completed
// $this->raiseError($p_message);
throw new Exception($p_message);
throw new \Exception($p_message);
}
// }}}
......
......@@ -7,10 +7,8 @@
namespace Drupal\Component\Archiver;
use Exception;
/**
* Defines an exception class for Drupal\Component\Archiver\ArchiverInterface.
*/
class ArchiverException extends Exception {
}
class ArchiverException extends \Exception {}
......@@ -7,9 +7,7 @@
namespace Drupal\Component\Plugin\Exception;
use Exception;
/**
* An exception class to be thrown for context plugin exceptions.
*/
class ContextException extends Exception implements ExceptionInterface { }
class ContextException extends \Exception implements ExceptionInterface { }
......@@ -6,10 +6,8 @@
namespace Drupal\Component\Plugin\Exception;
use Exception;
/**
* Generic Plugin exception class to be thrown when no more specific class
* is applicable.
*/
class PluginException extends Exception implements ExceptionInterface { }
class PluginException extends \Exception implements ExceptionInterface { }
......@@ -9,7 +9,6 @@
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Connection;
use Exception;
/**
* Defines the Database storage controller.
......@@ -81,7 +80,7 @@ public function read($name) {
$data = $this->decode($raw);
}
}
catch (Exception $e) {
catch (\Exception $e) {
}
return $data;
}
......
......@@ -13,8 +13,6 @@
use Drupal\Core\Database\SchemaObjectDoesNotExistException;
use Drupal\Core\Database\Schema as DatabaseSchema;
use Exception;
/**
* @addtogroup schemaapi
* @{
......@@ -516,7 +514,7 @@ public function tableExists($table) {
$this->connection->queryRange("SELECT 1 FROM {" . $table . "}", 0, 1);
return TRUE;
}
catch (Exception $e) {
catch (\Exception $e) {
return FALSE;
}
}
......@@ -533,7 +531,7 @@ public function fieldExists($table, $column) {
$this->connection->queryRange("SELECT $column FROM {" . $table . "}", 0, 1);
return TRUE;
}
catch (Exception $e) {
catch (\Exception $e) {
return FALSE;
}
}
......
......@@ -12,8 +12,6 @@
use Drupal\Core\Database\Driver\pgsql\Connection;
use Drupal\Core\Database\DatabaseNotFoundException;
use Exception;
/**
* PostgreSQL specific install functions
*/
......@@ -55,7 +53,7 @@ protected function connect() {
Database::getConnection();
$this->pass('Drupal can CONNECT to the database ok.');
}
catch (Exception $e) {
catch (\Exception $e) {
// Attempt to create the database if it is not found.
if ($e->getCode() == Connection::DATABASE_NOT_FOUND) {
// Remove the database string from connection info.
......@@ -118,7 +116,7 @@ protected function checkEncoding() {
$this->fail(st($text, $replacements));
}
}
catch (Exception $e) {
catch (\Exception $e) {
$this->fail(st('Drupal could not determine the encoding of the database was set to UTF-8'));
}
}
......@@ -145,7 +143,7 @@ function checkBinaryOutput() {
try {
db_query($query);
}
catch (Exception $e) {
catch (\Exception $e) {
// Ignore possible errors when the user doesn't have the necessary
// privileges to ALTER the database.
}
......@@ -233,7 +231,7 @@ function initializeDatabase() {
$this->pass(st('PostgreSQL has initialized itself.'));
}
catch (Exception $e) {
catch (\Exception $e) {
$this->fail(st('Drupal could not be correctly setup with the existing database. Revise any errors.'));
}
}
......
......@@ -13,8 +13,6 @@
use Drupal\Core\Database\SchemaObjectDoesNotExistException;
use Drupal\Core\Database\Schema as DatabaseSchema;
use Exception;
/**
* @addtogroup schemaapi
* @{
......
......@@ -16,7 +16,6 @@
use Drupal\Core\Database\Connection as DatabaseConnection;
use PDO;
use Exception;
use SplFileInfo;
/**
......@@ -161,7 +160,7 @@ public function __destruct() {
unlink($this->connectionOptions['database'] . '-' . $prefix);
}
}
catch (Exception $e) {
catch (\Exception $e) {
// Ignore the exception and continue. There is nothing we can do here
// to report the error or fail safe.
}
......
......@@ -12,8 +12,6 @@
use Drupal\Core\Database\DatabaseNotFoundException;
use Drupal\Core\Database\Install\Tasks as InstallTasks;
use Exception;
class Tasks extends InstallTasks {
protected $pdoDriver = 'sqlite';
......@@ -56,7 +54,7 @@ protected function connect() {
Database::getConnection();
$this->pass('Drupal can CONNECT to the database ok.');
}
catch (Exception $e) {
catch (\Exception $e) {
// Attempt to create the database if it is not found.
if ($e->getCode() == Connection::DATABASE_NOT_FOUND) {
// Remove the database string from connection info.
......
......@@ -11,9 +11,6 @@
use Drupal\Core\Database\SchemaObjectDoesNotExistException;
use Drupal\Core\Database\Schema as DatabaseSchema;
use Exception;
/**
* @ingroup schemaapi
* @{
......@@ -451,7 +448,7 @@ protected function introspectSchema($table) {
}
}
else {
new Exception("Unable to parse the column type " . $row->type);
new \Exception("Unable to parse the column type " . $row->type);
}
}
$indexes = array();
......
......@@ -10,7 +10,6 @@
use Drupal\Core\Database\Database;
use PDO;
use Exception;
/**
* Database installer structure.
......@@ -166,7 +165,7 @@ protected function connect() {
Database::getConnection();
$this->pass('Drupal can CONNECT to the database ok.');
}
catch (Exception $e) {
catch (\Exception $e) {
$this->fail(st('Failed to connect to your database server. The server reports the following message: %error.<ul><li>Is the database server running?</li><li>Does the database exist, and have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname?</li></ul>', array('%error' => $e->getMessage())));
return FALSE;
}
......@@ -181,7 +180,7 @@ protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) {
db_query($query);
$this->pass(st($pass));
}
catch (Exception $e) {
catch (\Exception $e) {
$this->fail(st($fail, array('%query' => $query, '%error' => $e->getMessage(), '%name' => $this->name())));
return !$fatal;
}
......
......@@ -9,8 +9,6 @@
use Drupal\Core\Database\Database;
use Exception;
/**
* General class for an abstracted INSERT query.
*/
......@@ -220,7 +218,7 @@ public function execute() {
$last_insert_id = $this->connection->query($sql, $insert_values, $this->queryOptions);
}
}
catch (Exception $e) {
catch (\Exception $e) {
// One of the INSERTs failed, rollback the whole batch.
$transaction->rollback();
// Rethrow the exception for the calling code.
......
......@@ -7,9 +7,7 @@
namespace Drupal\Core\Entity;
use Exception;
/**
* Defines an exception thrown when a malformed entity is passed.
*/
class EntityMalformedException extends Exception { }
class EntityMalformedException extends \Exception { }
......@@ -7,9 +7,7 @@
namespace Drupal\Core\Entity;
use Exception;
/**
* Defines an exception thrown when storage operations fail.
*/
class EntityStorageException extends Exception { }
class EntityStorageException extends \Exception { }
......@@ -6,11 +6,9 @@
namespace Drupal\Core\Executable;
use Exception;
use Drupal\Component\Plugin\Exception\ExceptionInterface;
/**
* Generic executable plugin exception class.
*/
class ExecutableException extends Exception implements ExceptionInterface {
}
class ExecutableException extends \Exception implements ExceptionInterface {}
......@@ -7,11 +7,7 @@
namespace Drupal\Core\TypedData;
use Exception;
/**
* Exception thrown when data wrappers miss contextual information.
*/
class MissingContextException extends Exception {
}
class MissingContextException extends \Exception {}
......@@ -7,11 +7,7 @@
namespace Drupal\Core\TypedData;
use Exception;
/**
* Exception thrown when trying to write or set ready-only data.
*/
class ReadOnlyException extends Exception {
}
class ReadOnlyException extends \Exception {}
......@@ -7,8 +7,6 @@
namespace Drupal\Core\Updater;
use Exception;
/**
* Defines a Exception class for the Drupal\Core\Updater\Updater class
* hierarchy.
......@@ -17,5 +15,4 @@
* specific name so that call sites that want to tell the difference can
* specifically catch these exceptions and treat them differently.
*/
class UpdaterException extends Exception {
}
class UpdaterException extends \Exception {}
......@@ -7,9 +7,7 @@
namespace Drupal\Core\Utility;
use Exception;
/**
* Exception class used to throw error if a module update fails.
*/
class UpdateException extends Exception { }
class UpdateException extends \Exception { }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment