-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Store query params in driver exceptions #4387
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
Conversation
Oops, after running Psalm, I realized that Thus I only see 2 solutions:
|
@morozov Please check this new version! |
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.
Looks like we're moving in the right direction.
@beberlei do you think we could include this into 3.0 instead of |
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.
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
{ | ||
if ($query !== null) { | ||
$message = 'An exception occurred while executing the query: ' . $driverException->getMessage(); |
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.
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! |
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.
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
DriverException
instead. 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!).