Skip to content

Commit

Permalink
[9.x] Throw LostDbConnectionException (#42102)
Browse files Browse the repository at this point in the history
* throw LostDbConnectionException

* formatting

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
imanghafoori1 and taylorotwell authored Apr 22, 2022
1 parent e069f6a commit f13736c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,7 @@ protected function prepared(PDOStatement $statement)
{
$statement->setFetchMode($this->fetchMode);

$this->event(new StatementPrepared(
$this, $statement
));
$this->event(new StatementPrepared($this, $statement));

return $statement;
}
Expand Down Expand Up @@ -823,9 +821,9 @@ protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $
/**
* Reconnect to the database.
*
* @return void
* @return mixed|false
*
* @throws \LogicException
* @throws \Illuminate\Database\LostConnectionException
*/
public function reconnect()
{
Expand All @@ -835,7 +833,7 @@ public function reconnect()
return call_user_func($this->reconnector, $this);
}

throw new LogicException('Lost connection and no reconnector available.');
throw new LostConnectionException('Lost connection and no reconnector available.');
}

/**
Expand Down
10 changes: 10 additions & 0 deletions LostConnectionException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Illuminate\Database;

use LogicException;

class LostConnectionException extends LogicException
{
//
}

0 comments on commit f13736c

Please sign in to comment.