Skip to content

Commit

Permalink
Change signature of DetectsLostConnections to accept Throwable (#22948)
Browse files Browse the repository at this point in the history
  • Loading branch information
ollielowson authored and taylorotwell committed Jan 29, 2018
1 parent 4204c8a commit c89439e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Concerns/ManagesTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function createSavepoint()
/**
* Handle an exception from a transaction beginning.
*
* @param \Exception $e
* @param \Throwable $e
* @return void
*
* @throws \Exception
Expand Down
5 changes: 3 additions & 2 deletions src/Illuminate/Database/Connectors/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PDO;
use Exception;
use Throwable;
use Doctrine\DBAL\Driver\PDOConnection;
use Illuminate\Database\DetectsLostConnections;

Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Database/DetectsLostConnections.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

namespace Illuminate\Database;

use Exception;
use Throwable;
use Illuminate\Support\Str;

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();

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c89439e

Please sign in to comment.