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

[TA] capture details #26962

Merged
merged 3 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, odata_error):
super().__init__(
odata_error["error"]["innererror"]
)
self.details = odata_error["error"].get("details", [])
except KeyError:
super().__init__(odata_error)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"Connection": "keep-alive",
"Content-Length": "721",
"Content-Type": "application/json",
"User-Agent": "azsdk-python-ai-textanalytics/5.2.0b5 Python/3.10.0 (Windows-10-10.0.22000-SP0)"
"User-Agent": "azsdk-python-ai-textanalytics/5.2.1 Python/3.10.0 (Windows-10-10.0.22621-SP0)"
},
"RequestBody": {
"analysisInput": {
Expand Down Expand Up @@ -65,21 +65,34 @@
},
"StatusCode": 400,
"ResponseHeaders": {
"apim-request-id": "6cad3063-1c60-446b-9e79-843ab6d57c58",
"apim-request-id": "d387e29c-6117-425a-9a2c-7feaaa23a753",
"Content-Type": "application/json; charset=utf-8",
"Date": "Thu, 09 Jun 2022 17:10:09 GMT",
"Date": "Thu, 20 Oct 2022 21:31:18 GMT",
"Server": "istio-envoy",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"Transfer-Encoding": "chunked",
"X-Content-Type-Options": "nosniff",
"x-envoy-upstream-service-time": "5"
"x-envoy-upstream-service-time": "137",
"x-http2-stream-id": "3",
"x-ms-region": "East US"
},
"ResponseBody": {
"error": {
"code": "InvalidRequest",
"message": "Invalid parameter in request",
"details": [
{
"code": "InvalidRequest",
"message": "Invalid Request.",
"innererror": {
"code": "InvalidParameterValue",
"message": "Job task parameter value \u0027bad\u0027 is not supported for model-version parameter for job task type PersonallyIdentifiableInformation. Supported values latest, 2020-07-01, 2021-01-15."
}
}
],
"message": "Invalid Request.",
"innererror": {
"code": "InvalidParameterValue",
"message": "Job task parameter value bad is not supported for model-version parameter for job task type KeyPhraseExtraction. Supported values latest,2019-10-01,2020-07-01,2021-05-01."
"message": "Job task: \u0027PersonallyIdentifiableInformation-2\u0027 failed with validation errors: [\u0027Invalid parameter in request\u0027]"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def test_invalid_language_hint_method(self, client):
def test_bad_model_version_error_multiple_tasks(self, client):
docs = [{"id": "1", "language": "en", "text": "I did not like the hotel we stayed at."}]

with pytest.raises(HttpResponseError):
with pytest.raises(HttpResponseError) as e:
res = client.begin_analyze_actions(
docs,
actions=[
Expand All @@ -560,6 +560,7 @@ def test_bad_model_version_error_multiple_tasks(self, client):
],
polling_interval=self._interval(),
).result()
assert e.value.error.details

@TextAnalyticsPreparer()
@TextAnalyticsClientPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def is_public_cloud():
TextAnalyticsPreparer = functools.partial(
PowerShellPreparer,
'textanalytics',
textanalytics_test_endpoint="https://fakeendpoint.cognitiveservices.azure.com",
textanalytics_test_endpoint="https://fakeendpoint.cognitiveservices.azure.com/",
textanalytics_test_api_key="fakeZmFrZV9hY29jdW50X2tleQ==",
)

Expand Down