Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged

Conversation

fnkhz
Copy link
Contributor

@fnkhz fnkhz commented Jan 13, 2022

Addresses: #802

@@ -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")));
Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sound good I think.

Copy link
Member

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.

Copy link
Contributor Author

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 🤔

Copy link
Member

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?

@DamirPorobic DamirPorobic merged commit 885fd96 into ksnip:master Feb 19, 2022
@DamirPorobic
Copy link
Member

Merged, thanks for providing this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants