Skip to content
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

[plugin] Wallabag: abort synchronisation on request error #8950

Merged
merged 2 commits into from Apr 15, 2022

Conversation

hrdl-github
Copy link
Contributor

@hrdl-github hrdl-github commented Mar 25, 2022

Fixes #8949. Not tested yet.


This change is Reviewable

@@ -430,6 +430,12 @@ function Wallabag:getArticleList()
.. filtering
local articles_json = self:callAPI("GET", articles_url, nil, "", "", true)

if articles_json == false then
Copy link
Member

Choose a reason for hiding this comment

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

This logic can't be right. ;-) This is identical to replacing the break a few lines down with return.

I haven't had the time to look at it, but the most typical idiom is probably to pass a reason along.

For example, at its simplest:

false, "connection error"

While if it's an HTTP error code, maybe

false, "http", status

In any case, the problem is that a "proper" error is conflated with another type. Conflating them the other way around would retain that problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I didn't see initially that non-200 http responses were also returning false instead of nil. Errors are handled when retrieving entries now. Error handling for minor actions (adding tags, adding/removing articles) is not implemented yet.

@hrdl-github hrdl-github marked this pull request as draft March 25, 2022 22:07
@hrdl-github hrdl-github marked this pull request as ready for review April 8, 2022 16:46
Copy link
Member

@Frenzie Frenzie left a comment

Choose a reason for hiding this comment

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

Looks okay at a glance. Did you test the different scenarios?

@hrdl-github
Copy link
Contributor Author

I tested some scenarios that would trigger a network_error. I have been using this patch for the past two weeks without noticing any other issues.

@Frenzie Frenzie merged commit 4fe39d6 into koreader:master Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wallabag: request errors occasionally result in deletion of all articles
2 participants