Skip to content

Commit 243a0db

Browse files
[TA ] improve per-document error message when all documents fail per action (Azure#26902)
* fix bad Document error message when all actions fail * update changelog * update wording
1 parent 0cadbad commit 243a0db

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22

33
## 5.2.1 (Unreleased)
44

5-
### Features Added
6-
7-
### Breaking Changes
8-
95
### Bugs Fixed
10-
11-
### Other Changes
6+
- Returns a more helpful message in the document error when all documents fail for an action in the `begin_analyze_actions` API.
127

138
## 5.2.0 (2022-09-08)
149

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_response_handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ def _get_doc_results(task, doc_id_order, returned_tasks_object):
409409
# if no results present, check for action errors
410410
if response_task_to_deserialize.results is None:
411411
return get_ordered_errors(returned_tasks_object, task_name, doc_id_order)
412-
# if results obj present, but no document results (likely a canceled scenario)
413-
if not response_task_to_deserialize.results.documents:
412+
# if results obj present, but no document results or errors (likely a canceled scenario)
413+
if not response_task_to_deserialize.results.documents and not response_task_to_deserialize.results.errors:
414414
return pad_result(returned_tasks_object, doc_id_order)
415415
return deserialization_callback(
416416
doc_id_order, response_task_to_deserialize.results, {}, lro=True

sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ def test_invalid_language_hint_method(self, client):
540540
for document_results in response:
541541
for doc in document_results:
542542
assert doc.is_error
543+
assert doc.error.code == "UnsupportedLanguageCode"
543544

544545
@TextAnalyticsPreparer()
545546
@TextAnalyticsClientPreparer()

0 commit comments

Comments
 (0)