Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
- improved connection exception handling for postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy-j committed Nov 20, 2019
1 parent 585d09b commit edc3ed3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG for 0.9.0 RC
======================

2.6.3 (20.11.2019)
-----
- improved connection exception handling for Postgres

2.6.2 (14.11.2019)
-----
- added native support for UUID type
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ protected function formatDatetime(\DateTimeInterface $value): string
*
* @throws StatementException
*/
private function statement(string $query, array $parameters = [], bool $retry = null): StatementInterface
private function statement(string $query, array $parameters = [], bool $retry = true): StatementInterface
{
if (is_null($retry)) {
$retry = $this->options['reconnect'];
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Postgres/PostgresDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ protected function mapException(\PDOException $exception, string $query): Statem
if (
strpos($exception->getMessage(), '0800') !== false
|| strpos($exception->getMessage(), '080P') !== false
|| strpos($exception->getMessage(), 'connection') !== false
) {
return new StatementException\ConnectionException($exception, $query);
}
Expand All @@ -161,7 +162,6 @@ protected function mapException(\PDOException $exception, string $query): Statem
return new StatementException\ConstrainException($exception, $query);
}


return new StatementException($exception, $query);
}
}

0 comments on commit edc3ed3

Please sign in to comment.