Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf0abe3

Browse files
committed
Merge pull request laravel#7580 from GrahamForks/5.0-pgsql
[5.0] Fixed issue with loosing connection to pgsql
2 parents cafa009 + e2124c5 commit bf0abe3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Illuminate/Database/Connection.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,15 @@ protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $
651651
/**
652652
* Determine if the given exception was caused by a lost connection.
653653
*
654-
* @param \Illuminate\Database\QueryException
654+
* @param \Illuminate\Database\QueryException $e
655655
* @return bool
656656
*/
657657
protected function causedByLostConnection(QueryException $e)
658658
{
659-
return str_contains($e->getPrevious()->getMessage(), 'server has gone away');
659+
$message = $e->getPrevious()->getMessage();
660+
661+
return str_contains($message, 'server has gone away')
662+
|| str_contains($message, 'no connection to the server');
660663
}
661664

662665
/**

0 commit comments

Comments
 (0)