Store query params in driver exceptions#4387
Conversation
|
Oops, after running Psalm, I realized that Thus I only see 2 solutions:
|
|
@morozov Please check this new version! |
morozov
left a comment
There was a problem hiding this comment.
Looks like we're moving in the right direction.
|
@beberlei do you think we could include this into 3.0 instead of |
morozov
left a comment
There was a problem hiding this comment.
Logic-wise looks good to me, only the upgrade notes are missing. Could you try to retarget against 3.0.x?
src/Exception/DriverException.php
Outdated
| public function __construct(Driver\Exception $driverException, ?Query $query) | ||
| { | ||
| if ($query !== null) { | ||
| $message = 'An exception occurred while executing the query: ' . $driverException->getMessage(); |
There was a problem hiding this comment.
Not sure which "the query" is being referred to since there's no query in the context. @greg0ire what would be the proper wording?
|
@doctrine/team-dbal, please be informed. With this change, the query and its parameters will be no longer part of the exception message but will be accessible via |
1b08200 to
0bb0233
Compare
|
@morozov Rebased on |
|
@BenMorel I believe the wording is not that critical but the upgrade notes are still missing. |
|
@morozov Done! By the way, shouldn't |
That would make sense, I think. I believe all exception constructors should be internal (not in this patch) since only the DBAL is supposed to instantiate them. |
Should I make at least these 2 |
Yeah, let's do, and update the upgrade notes accordingly. The wording changes look good to me as well, so it may be also the time to squash everything. |
c1c6281 to
73abd2e
Compare
|
@morozov Done! |
morozov
left a comment
There was a problem hiding this comment.
I'm sorry. I misread your question in #4387 (comment) and thought you were asking about constructors in both cases.
|
Looks good. |
06732c5 to
a3490cd
Compare
|
Squashed! |
a3490cd to
26fe027
Compare
|
Thanks, @BenMorel! |
Summary
This is an attempt at #4325 (comment).
This PR removes the text representation of the bound parameters in the query exception message, and stores these params together with their types in the
DriverExceptioninstead. This shifts the responsibility of (not) storing/displaying bound parameters explicitly to the consumer of the exception.Just like #4325, this removes the dependency on ext-json (plus a couple lines of code!).