-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
MasterSlaveConnection::ping() throws PDOException #3313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,11 +5,13 @@ | |
| use Doctrine\Common\EventManager; | ||
| use Doctrine\DBAL\Configuration; | ||
| use Doctrine\DBAL\Connection; | ||
| use Doctrine\DBAL\DBALException; | ||
| use Doctrine\DBAL\Driver; | ||
| use Doctrine\DBAL\Driver\Connection as DriverConnection; | ||
| use Doctrine\DBAL\Event\ConnectionEventArgs; | ||
| use Doctrine\DBAL\Events; | ||
| use InvalidArgumentException; | ||
| use Throwable; | ||
| use function array_rand; | ||
| use function count; | ||
| use function func_get_args; | ||
|
|
@@ -352,7 +354,11 @@ public function query() | |
| $logger->startQuery($args[0]); | ||
| } | ||
|
|
||
| $statement = $this->_conn->query(...$args); | ||
| try { | ||
| $statement = $this->_conn->query(...$args); | ||
| } catch (Throwable $e) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above: we upcast these, so if we need to further wrap it there's something else going on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I follow the same idea from the regular Connection class https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php#L1011-L1015 |
||
| throw DBALException::driverExceptionDuringQuery($this->_driver, $e, $args[0]); | ||
| } | ||
|
|
||
| if ($logger) { | ||
| $logger->stopQuery(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does a
PDOExceptionoccur? I believe we upcast those, so this is fixing a symptomUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may stay with
DBALExceptiononly for case when we will catchThrowableand convert them to the DBALException in thequerymethods.https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php#L1011-L1015