-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Let the transport handles bad urls #12106
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for doing this!
If the input kwargs do not satisfy template, why not raise error? I have some concerns if we modify the template silently. Maybe we should just give a more descriptive error message? |
What error would you raise? You don't have enough information other that "something is wrong", building the url leniently and let the transport decide if it's malformed sounds fair to me. What are your concerns? |
My concern is the case that after we skip some components, it is still a valid URL but returns different response. e.g. api_version_number. Because we skip it silently for user, it may confuse users. |
@xiangyan99 if I catch the error, only thing I know is that something the customer provided is not right. I don't know if it's a client parameter (like endpoint), I don't know if it's an operation parameter, I don't know if it's both. I could raise something like this:
Thoughts? |
We can likely include the contents of |
I think the point is if there is something wrong, we would like it to fail on compile time (when building the url) than un-deterministic result (may or may not fail when sending it to server). Your ideas? |
is this better:
Thoughts? Edit: |
I've seen users run into this error in two ways:
In the first case, we do get a good error back from the transport. In the second case, we get this:
... which is not so good. So in that case I would be happy with this:
|
accidentally chop off https is often handles individually by clients - we do it in storage, search etc. |
@annatisch @rakshith91 @kristapratico @xiangyan99 I pushed an update, how does it sound? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this change
…into regenerate_certs * 'master' of https://github.com/Azure/azure-sdk-for-python: [text analytics] remove duplicate platform info in user agent (Azure#12123) [form recognizer] remove duplicate platform info in user agent (Azure#12124) fix broken links (Azure#12100) Document "<unchanged>" for DataSourceCredentials.connectionString if it is empty (Azure#12129) Let the transport handles bad urls (Azure#12106) Remove Unneeded Reference to repository resource (Azure#11929) enable logging for tests (Azure#12110) fix network in batch testcase (Azure#12114) update test recording for appservice (Azure#12116) Add test for connection monitor and fix test api version. (Azure#12113) Minor root readme and mgmt quickstart update for Track 2 mgmt sdk (Azure#12112) Quickstart for Track 2 preview management libraries and update root readme for track 2 (Azure#11384) Seg fault fix (Azure#11933)
…into regenerate_keys * 'master' of https://github.com/Azure/azure-sdk-for-python: [text analytics] remove duplicate platform info in user agent (Azure#12123) [form recognizer] remove duplicate platform info in user agent (Azure#12124) fix broken links (Azure#12100) Document "<unchanged>" for DataSourceCredentials.connectionString if it is empty (Azure#12129) Let the transport handles bad urls (Azure#12106) Remove Unneeded Reference to repository resource (Azure#11929) enable logging for tests (Azure#12110) fix network in batch testcase (Azure#12114) update test recording for appservice (Azure#12116) Add test for connection monitor and fix test api version. (Azure#12113) Minor root readme and mgmt quickstart update for Track 2 mgmt sdk (Azure#12112) Quickstart for Track 2 preview management libraries and update root readme for track 2 (Azure#11384) Seg fault fix (Azure#11933)
…into regenerate_secrets * 'master' of https://github.com/Azure/azure-sdk-for-python: (39 commits) [text analytics] remove duplicate platform info in user agent (Azure#12123) [form recognizer] remove duplicate platform info in user agent (Azure#12124) fix broken links (Azure#12100) Document "<unchanged>" for DataSourceCredentials.connectionString if it is empty (Azure#12129) Let the transport handles bad urls (Azure#12106) Remove Unneeded Reference to repository resource (Azure#11929) enable logging for tests (Azure#12110) fix network in batch testcase (Azure#12114) update test recording for appservice (Azure#12116) Add test for connection monitor and fix test api version. (Azure#12113) Minor root readme and mgmt quickstart update for Track 2 mgmt sdk (Azure#12112) Quickstart for Track 2 preview management libraries and update root readme for track 2 (Azure#11384) Seg fault fix (Azure#11933) [formrecognizer] update formrecognizer links to new aka.ms naming (Azure#12079) changes in samples tests (Azure#12090) readme & sample updates (Azure#12095) Update Key Vault minimum azure-core to 1.4.0 (Azure#12074) [formrecognizer] test parity with other languages (Azure#12059) syncing missing changelog items (Azure#12089) updating doc references (Azure#12086) ...
See #11048
If a bad combination of parametrized host + incorrect client creation happen, do not crash while trying to build the Url, but build something, and let the transport decides what to do.
For requests, the new trace is now:
For aiohttp:
which is way better than the current error you can see on issue #11048
EDIT: Will now raise an exception