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

[azure-core] Raise better error message for malformed endpoint #11048

Closed
kristapratico opened this issue Apr 24, 2020 · 2 comments
Closed

[azure-core] Raise better error message for malformed endpoint #11048

kristapratico opened this issue Apr 24, 2020 · 2 comments
Assignees
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library.

Comments

@kristapratico
Copy link
Member

In reference to this issue: #9521

If the endpoint passed is malformed in some way, e.g. the https:// is chopped off, we get a cryptic message raised from azure.core :

File "C:\Users\krpratic\azure-sdk-for-python\env\lib\site-packages\azure\core\pipeline\transport\_base.py", line 695, in format_url
    base = self._base_url.format(**kwargs).rstrip("/")
KeyError: 'Endpoint'

KeyError should be raised with a better error message, e.g., like:

‘Failed to make service call. Did not understand the endpoint passed in: {some broken endpoint}. Please ensure that it is a valid URL’.

@kristapratico kristapratico added Azure.Core Client This issue points to a problem in the data-plane of the library. labels Apr 24, 2020
@lmazuel lmazuel self-assigned this May 19, 2020
@lmazuel
Copy link
Member

lmazuel commented Jun 17, 2020

Full stacktrace:

Traceback (most recent call last):
  File ".\broken_endpoint.py", line 15, in <module>
    response = text_analytics_client.analyze_sentiment(documents, language="en")
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\core\azure-core\azure\core\tracing\decorator.py", line 83, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\textanalytics\azure-ai-textanalytics\azure\ai\textanalytics\_text_analytics_client.py", line 414, in analyze_sentiment
    **kwargs
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\textanalytics\azure-ai-textanalytics\azure\ai\textanalytics\_generated\operations\_text_analytics_client_operations.py", line 373, in sentiment
    request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\core\azure-core\azure\core\pipeline\transport\_base.py", line 798, in post
    "POST", url, params, headers, content, form_content, stream_content
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\core\azure-core\azure\core\pipeline\transport\_base.py", line 685, in _request
    request = HttpRequest(method, self.format_url(url))
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\core\azure-core\azure\core\pipeline\transport\_base.py", line 721, in format_url
    base = self._base_url.format(**kwargs).rstrip("/")
KeyError: 'Endpoint'

@xiangyan99
Copy link
Member

Fixed in #12106

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

No branches or pull requests

3 participants