-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
aiohttp raises ValueError for invalid Location: in redir #2630
Comments
|
Yes. I was expecting a better-named exception than ValueError, and text like 'Redirect Location header is invalid' |
If you need a new feature -- please make a Pull Request ;) |
I don't know what the exception should be named, or which library it should be named in. Those are architecture questions. Heck, for all I know you think ValueError() is a fine error for aiohttp to have, and this bug is invalid. I don't know. |
Also encountered this problem. Shouldn't this return an instance of the |
I've been recently similarly affected by this. Catching ValueError feels a little too broad on a call to I'm a strong second on @deasmhumhna request for |
This patch introduces 5 granular user-facing exceptions that may occur when HTTP requests are made: * `InvalidUrlClientError` * `RedirectClientError` * `NonHttpUrlClientError` * `InvalidUrlRedirectClientError` * `NonHttpUrlRedirectClientError` Previously `ValueError` or `InvalidURL` was raised and screening out was complicated (a valid URL that redirects to invalid one raised the same error as an invalid URL). Ref: aio-libs#6722 (comment) PR aio-libs#6722 Resolves aio-libs#2507 Resolves aio-libs#2630 Resolves aio-libs#3315 Co-authored-by: Sviatoslav Sydorenko <sviat@redhat.com> (cherry picked from commit fb465e1)
…rchy in the HTTP client (#8158) **This is a backport of PR #6722 as merged into master (fb465e1).** This patch introduces 5 granular user-facing exceptions that may occur when HTTP requests are made: * `InvalidUrlClientError` * `RedirectClientError` * `NonHttpUrlClientError` * `InvalidUrlRedirectClientError` * `NonHttpUrlRedirectClientError` Previously `ValueError` or `InvalidURL` was raised and screening out was complicated (a valid URL that redirects to invalid one raised the same error as an invalid URL). Ref: #6722 (comment) PR #6722 Resolves #2507 Resolves #2630 Resolves #3315 Co-authored-by: Sviatoslav Sydorenko <sviat@redhat.com> (cherry picked from commit fb465e1)
Long story short
I am crawling lots of sites, and I don't expect aiohttp to be raising ValueError.
Expected behaviour
Raise an exception that's documented
Actual behaviour
Yarl's ValueError is passed up to the top
Steps to reproduce
Note:
Your environment
aiohttp==2.3.6
yarl==0.16.0
The text was updated successfully, but these errors were encountered: