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

Add error argument to req_perform_iteratively() #310

Closed
mgirlich opened this issue Sep 6, 2023 · 7 comments · Fixed by #361
Closed

Add error argument to req_perform_iteratively() #310

mgirlich opened this issue Sep 6, 2023 · 7 comments · Fixed by #361
Labels
feature a feature request or enhancement

Comments

@mgirlich
Copy link
Collaborator

mgirlich commented Sep 6, 2023

In case a request fails it might still be interesting to continue (if possible) with the pagination or return the intermediate results.

@hadley
Copy link
Member

hadley commented Sep 6, 2023

There's possibly some connection to cancel_on_error on in multi_req_perform(). We should probably also switch to using an enum for the reasons mentioned in https://design.tidyverse.org/explicit-strategies.html#only-two-strategies.

@mgirlich
Copy link
Collaborator Author

mgirlich commented Sep 7, 2023

The error message when parse_resp() fails should also be improved.

@hadley hadley added the feature a feature request or enhancement label Sep 28, 2023
@hadley

This comment was marked as outdated.

@mgirlich

This comment was marked as outdated.

@hadley hadley changed the title Add error argument to paginate_req_perform() Add error argument to req_perform_iteratively() Oct 13, 2023
@hadley
Copy link
Member

hadley commented Oct 21, 2023

Maybe something like:

  • "error" (the default): the iteration ends with an error.
  • "terminate": terminate the iteration and return progress
  • "continue": continue, ignoring the error

If you use terminate or continue the return value might be a mix of responses and errors, not just responses.

@mgirlich
Copy link
Collaborator Author

Sounds good to me.

@hadley
Copy link
Member

hadley commented Oct 25, 2023

I realised continue won't work for most of the iteration helpers (i.e. anything that depends on a request), and none of the error behaviours is terribly useful if we don't have a way to also track the response. I liked your idea of adding the request as attribute to the response, and maybe it makes sense to do that for the httr2_failure and httr2_http errors too.

hadley added a commit that referenced this issue Oct 30, 2023
Fixes #303. Fixes #310

This has a very similar interface to `req_perform_parallel()` but because it just does one request after another, it doesn't have any of the limitations of that function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants