-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[#3170] Adds error to logger and executes stopQuery even on exception. #3174
Conversation
@Ocramius this is something to consider for #3156. In fact, my biggest concern is still that the DBAL's logging API is not extensible (it doesn't follow the open/closed principle). If we decide to log some other query execution details (e.g. number of returned/affected rows), we'll have to modify the A more extensible solution would be to extract some Do you have any ideas? |
@morozov any chance we can merge this quick fix here and continue the discussion about the new logger interface in the other isse? |
This assumes that IMO this shouldn't go through:
This is not really a fix, and rather introduces more issues instead. |
@Ocramius that is true. My initial idea was tro create a new interface extending the existing one that would allow us to do so. I updated my PR accordingly. |
I believe the new interface should be called `SQLLoggerExtended` maybe?
|
2994106
to
c80963f
Compare
c80963f
to
aa5e429
Compare
@jcchavezs the major problem with the proposed solution is that instead of having one non-extensible logger we have two non-extensible loggers and a bunch of new Let's say tomorrow I want to log how many rows the We should either implement something like described in #3174 (comment) or just implement the ability to log exceptions in a non-breaking way. |
I totally agree we need a more coherent way of logging but with the current setup this is IMO the only way to accept errors in logger without breaking existing clients. I believe the logger discussion should be kept in the other issue and the release will come in probably a major change. This is an minor change and even if we deprecate or remove Any idea on how we could do it in a better way without requiring a breaking change in logger @morozov? Any thoughts @Ocramius? |
Summary
This PR adds the
stopQuery
error for when the query fails and in that case, pass the exception to thestopQuery($ex)
.It is important to mention that this does not break existing clients as the interface remains the same while clients can retrieve the exception by using
func_get_args
.Ping @morozov