-
Notifications
You must be signed in to change notification settings - Fork 4.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
[FormRecognizer] Preview 1: throw RequestFailedException when long-running operation has failed #11460
Conversation
sdk/formrecognizer/Azure.AI.FormRecognizer/src/RecognizeCustomFormsOperation.cs
Show resolved
Hide resolved
sdk/formrecognizer/Azure.AI.FormRecognizer/src/RecognizeCustomFormsOperation.cs
Outdated
Show resolved
Hide resolved
...cognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs
Outdated
Show resolved
Hide resolved
...cognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs
Show resolved
Hide resolved
...cognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs
Show resolved
Hide resolved
sdk/formrecognizer/Azure.AI.FormRecognizer/src/RecognizeCustomFormsOperation.cs
Show resolved
Hide resolved
@@ -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 | |||
|
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.
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.
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 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.
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.
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).