From 049f9e205d3f093627f44c1d87205abe93fb1945 Mon Sep 17 00:00:00 2001 From: Ollie Lowson Date: Sun, 28 Jan 2018 21:28:09 +0000 Subject: [PATCH] Change signature of DetectsLostConnections to accept Throwable --- src/Illuminate/Database/Concerns/ManagesTransactions.php | 2 +- src/Illuminate/Database/Connectors/Connector.php | 5 +++-- src/Illuminate/Database/DetectsLostConnections.php | 6 +++--- src/Illuminate/Queue/Worker.php | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Database/Concerns/ManagesTransactions.php b/src/Illuminate/Database/Concerns/ManagesTransactions.php index ec979f4edfd7..1b7312426c65 100644 --- a/src/Illuminate/Database/Concerns/ManagesTransactions.php +++ b/src/Illuminate/Database/Concerns/ManagesTransactions.php @@ -129,7 +129,7 @@ protected function createSavepoint() /** * Handle an exception from a transaction beginning. * - * @param \Exception $e + * @param \Throwable $e * @return void * * @throws \Exception diff --git a/src/Illuminate/Database/Connectors/Connector.php b/src/Illuminate/Database/Connectors/Connector.php index b772f5212527..4a2c82fb1bc7 100755 --- a/src/Illuminate/Database/Connectors/Connector.php +++ b/src/Illuminate/Database/Connectors/Connector.php @@ -4,6 +4,7 @@ use PDO; use Exception; +use Throwable; use Doctrine\DBAL\Driver\PDOConnection; use Illuminate\Database\DetectsLostConnections; @@ -82,7 +83,7 @@ protected function isPersistentConnection($options) /** * Handle an exception that occurred during connect execution. * - * @param \Exception $e + * @param \Throwable $e * @param string $dsn * @param string $username * @param string $password @@ -91,7 +92,7 @@ protected function isPersistentConnection($options) * * @throws \Exception */ - protected function tryAgainIfCausedByLostConnection(Exception $e, $dsn, $username, $password, $options) + protected function tryAgainIfCausedByLostConnection(Throwable $e, $dsn, $username, $password, $options) { if ($this->causedByLostConnection($e)) { return $this->createPdoConnection($dsn, $username, $password, $options); diff --git a/src/Illuminate/Database/DetectsLostConnections.php b/src/Illuminate/Database/DetectsLostConnections.php index d2e1878fdd2d..4cac2b6f00ee 100644 --- a/src/Illuminate/Database/DetectsLostConnections.php +++ b/src/Illuminate/Database/DetectsLostConnections.php @@ -2,7 +2,7 @@ namespace Illuminate\Database; -use Exception; +use Throwable; use Illuminate\Support\Str; trait DetectsLostConnections @@ -10,10 +10,10 @@ trait DetectsLostConnections /** * Determine if the given exception was caused by a lost connection. * - * @param \Exception $e + * @param \Throwable $e * @return bool */ - protected function causedByLostConnection(Exception $e) + protected function causedByLostConnection(Throwable $e) { $message = $e->getMessage(); diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 77d25d7d6477..13699cca9d83 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -284,7 +284,7 @@ protected function runJob($job, $connectionName, WorkerOptions $options) /** * Stop the worker if we have lost connection to a database. * - * @param \Exception $e + * @param \Throwable $e * @return void */ protected function stopWorkerIfLostConnection($e)