-
Notifications
You must be signed in to change notification settings - Fork 654
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
log all QNetworkReply error messages at debug level #3732
Conversation
c011839
to
ad458a5
Compare
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.
Think we could add or modify some unit tests to assert the different log levels?
5d58224
to
770f789
Compare
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.
Thanks Lev. I have a few questions below.
src/network/url_downloader.cpp
Outdated
// Log the original error message at debug level | ||
mpl::log(mpl::Level::debug, | ||
category, | ||
fmt::format("Qt error {}: {}", static_cast<int>(error_code), error_string)); |
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.
Are you aware of mp::utils::qenum_to_string
?
src/network/url_downloader.cpp
Outdated
fmt::format("Qt error {}: {}", static_cast<int>(error_code), error_string)); | ||
|
||
const bool is_timeout_error = (error_code == QNetworkReply::TimeoutError); | ||
const auto msg = is_timeout_error ? "Network timeout" : error_string; |
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.
Do we still need to replace Qt's timeout message with "Network timeout"?
src/network/url_downloader.cpp
Outdated
|
||
if (is_timeout_error && download_timeout.isActive()) | ||
{ | ||
mpl::log(mpl::Level::debug, category, "Timeout error detected but download_timeout is still active"); |
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.
Would this indicate an error in our logic? Or in what circumstances is it expected to occur?
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.
The line used to be
const auto msg = download_timeout.isActive() ? reply->errorString().toStdString() : "Network timeout";
So this line is to check if TimeoutErrors happen even when download_timeout.isActive() is true to potentially shed some light on the "instant timeouts" issue and see if its related to QTimer
Note however that the "timeouts" we are getting in #3662 are from us calling abort() which throw an OperationCanceledError with "Operation canceled" as the error string.
https://doc.qt.io/qt-6/qnetworkreply.html#NetworkError-enum
So this is irrelevant for resolving that issue.
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.
Should this be a warning though?
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.
Should this be a warning though?
I guess it can be at error level, but this should never be triggered by an OperationCanceledError and doesn't have any impact on the rest of the error handling which is why I originally put it as debug
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 have no more comments. Thanks @levkropp
770f789
to
0ca1610
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3732 +/- ##
=======================================
Coverage 88.86% 88.87%
=======================================
Files 256 256
Lines 14569 14579 +10
=======================================
+ Hits 12947 12957 +10
Misses 1622 1622 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
e11c6be
to
027d372
Compare
src/network/url_downloader.cpp
Outdated
|
||
if (download_timeout.isActive()) | ||
{ | ||
mpl::log(mpl::Level::debug, category, "download_timeout is still active"); | ||
} |
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.
if (download_timeout.isActive()) | |
{ | |
mpl::log(mpl::Level::debug, category, "download_timeout is still active"); | |
} | |
mpl::log(mpl::Level::debug, category, fmt::format("download_timeout is {}active", download_timeout.isActive() ? "" : "in")); |
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 added a final suggestion, but it looks good to me now. Thanks!
079cb01
to
aae279b
Compare
@levkropp Merge conflicts |
8ec5b61
to
92d559e
Compare
92d559e
to
cc8d248
Compare
The enum for timeouts in Qt's networking library is
QNetworkReply::TimeoutError
. Different logs are printed at debug, warning, and error levels.MULTI-1529