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

Catch 404 in paging next #147

Merged
merged 1 commit into from
Feb 17, 2020
Merged

Catch 404 in paging next #147

merged 1 commit into from
Feb 17, 2020

Conversation

felix-hilden
Copy link
Owner

@felix-hilden felix-hilden commented Feb 15, 2020

Fixes #145, this works but I don't like the solution. I'd like to refactor it in some way. See also this question on SE Code Review.

@felix-hilden
Copy link
Owner Author

We could at least simplify a bit: use a larger exception hierarchy to catch only 404 in the except.

@HarrySky
Copy link
Contributor

HarrySky commented Feb 16, 2020

I tried to use decorator for catching 404 error, but in the end this idea did not work, since somewhere should be two versions of this try-catch block - one with await keyword and one without.

Idea I got - modifying handle_errors function to remove body from response if 404. That way you will return None. But it is a bit hack-ish :)

Your solution is not that bad, maybe there is no way to reduce duplication in case of try-catch with both async and sync variants. But maybe SE code review question will provide one.

P.S. I forgot to say thank you for your library - I restored part of my Melodiam webservice with it and will continue adding/restoring more features 👍

@felix-hilden
Copy link
Owner Author

Thanks for trying it out anyway! Yeah, I wouldn't call removing the body an optimal solution. I think we'll go with expanding the exceptions.

You're most welcome! Your help with the async client was invaluable. I'm glad it enabled you to restore your application!

@felix-hilden felix-hilden changed the title WIP: Catch 404 in paging next Catch 404 in paging next Feb 17, 2020
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.

Search paging and exceeding limits
2 participants