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

[FormRecognizer] Preview 1: throw RequestFailedException when long-running operation has failed #11460

Merged
merged 13 commits into from
Apr 21, 2020

Conversation

kinelski
Copy link
Member

@kinelski kinelski commented Apr 20, 2020

These changes properly handle "operation failed" scenarios in which an unexpected 200 HTTP status code is returned from the service. A RequestFailedException is being thrown when this happens.

Fixes #10334.
Addresses #10625, but tests could still be needed (under discussion).

@kinelski kinelski added Cognitive Services Client This issue points to a problem in the data-plane of the library. FormRecognizer labels Apr 20, 2020
@kinelski kinelski added this to the [2020] May milestone Apr 20, 2020
@kinelski kinelski requested a review from AlexGhiondea as a code owner April 20, 2020 23:15
@kinelski kinelski self-assigned this Apr 20, 2020
@@ -102,9 +102,6 @@ private async ValueTask<Response> UpdateStatusAsync(bool async, CancellationToke
? await _serviceClient.GetAnalyzeLayoutResultAsync(new Guid(Id), cancellationToken).ConfigureAwait(false)
: _serviceClient.GetAnalyzeLayoutResult(new Guid(Id), cancellationToken);

// TODO: Handle correctly according to returned status code
// https://github.com/Azure/azure-sdk-for-net/issues/10386

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to handle a Failed OperationStatus the same way for receipts and content as we're doing in custom form? If the operation failed for some reason, we might similarly throw the wrong exception type here by trying to deserialize the PageResults & ReadResults from the response body.

If we don't know of an instance of this happening in the service currently, it would be good to file an issue to track it for Preview 3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that filing an issue is a good idea. Like you suggested, I'm not aware of a scenario where this could be an issue. Receipt and content recognition seem to be way more resilient to these kind of errors than the custom endpoint.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kinelski kinelski merged commit 8f5c50c into Azure:master Apr 21, 2020
@kinelski kinelski deleted the fr-200 branch April 21, 2020 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Form Recognizer Cognitive Services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HTTP Status Codes:] Correctly handle 200/failure messages from LROs
3 participants