-
-
Notifications
You must be signed in to change notification settings - Fork 198
Fix invalid notification title in Imgur failed uploads #803
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
Fix invalid notification title in Imgur failed uploads #803
Conversation
@@ -157,9 +157,9 @@ void ImgurWrapper::handleDataResponse(const QDomElement& element) const | |||
emit tokenRefreshRequired(); | |||
} else { | |||
if (element.elementsByTagName(QLatin1String("error")).isEmpty()) { | |||
emit error(QLatin1String("Server responded with ") + element.attribute(QLatin1String("status"))); | |||
emit error(QNetworkReply::ProtocolFailure, QLatin1String("Server responded with ") + element.attribute(QLatin1String("status"))); |
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.
Pretty sure ProtocolFailure is the best option for these errors.
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.
Sound good I think.
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.
Though I'm not sure if we should pass the QNetworkReply outside the Warpper. The idea of the wrapper is to hide the implementation, the upload could happen via network or be send via pigeon, the caller shouldn't know about it. Is there a way to not pass this enum outside the the Warpper? Haven't had time to look into it yet, I can check it over the weekend.
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.
Can't think of another way 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.
Looking at the code, is the error type that much relevant? In the path with the settings we ignore it completely. From my point of view the issue was UploadStatus::NoError
in the imgurError
method, there it should have been something like UploadStatus::WebError
. How about moving the mapping method into the ImgurWrapper class and formatting the error string based on the type and only returning the string again. So or so we only forward this information to the notification service and show it to the user, we have no special treatment based on type. What do you think?
Merged, thanks for providing this PR! |
Addresses: #802