Skip to content

Exceptions handling and retry middleware - #15

Closed
pavlokomarov wants to merge 3 commits into
roach-php:mainfrom
pavlokomarov:exceptions_handling_and_retry_middleware
Closed

pavlokomarov wants to merge 3 commits into
roach-php:mainfrom
pavlokomarov:exceptions_handling_and_retry_middleware

Conversation

@pavlokomarov

Copy link
Copy Markdown

This PR adds:

  1. HTTP exceptions handling
  2. RetryMiddleware, based on HTTP exceptions handling

@ksassnowski please review this changes and help me to draw up this PR, if this functionality are needs in package :)

@pavlokomarov pavlokomarov mentioned this pull request Jan 16, 2022
@ksassnowski

Copy link
Copy Markdown
Contributor

Thanks for the patience and thanks for your contribution!

In it’s current state, this PR is a little too big and changes too many things at once. I’d like to split this up into several smaller PRs. I think the most important part is adding a onRejected handler for requests. I would like this handler to simply return the response as well instead of throwing an exception. Because it might be useful to write middleware that deal with failed requests/responses.

After that, we can take a look at the kinds of default middleware that would make sense to add to this package. Looking at Scrapy again, an HttpStatusMiddleware that filters out requests with a certain response code could make sense. But this would be another PR.

So if you want to open a new PR that adds an onRejected handler, I would appreciate it. Then, we can work from there :)

I’m going to close this PR, but we can continue discussing the changes here until we have a new PR.

@ksassnowski ksassnowski closed this Feb 1, 2022
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