Skip to content
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
4 changes: 2 additions & 2 deletions sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## 1.0.0-beta.3 (Unreleased)
- Rename parameters data and sourceUrl parameters found on methods for FormRecognizerClient to form and formUrl, respectively.
- Rename parameters for receipt API methods to receipt and receiptUrl.
- Raise `HttpResponseException` when a model with `ModelStatus.Invalid` is returned from the `beginTraining()` API's
- Fix `HttpResponseException` to include the error object thrown on invalid analyze status for recognize API's
- Raise `FormRecognizerException` when a model with `ModelStatus.Invalid` is returned from the `beginTraining()` API's
- Raise `FormRecognizerException` when invalid analyze status returned from service for recognize API's
- Update FormField property `transactionTime` on `USReceipt` to return `LocalTime` instead of `String`
- Rename model `PageRange` to `FormPageRange`
- Rename property `startPageNumber` to `firstPageNumber` and `endPageNumber` to `lastPageNumber` in model `PageRange`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import com.azure.ai.formrecognizer.implementation.FormRecognizerClientImpl;
import com.azure.ai.formrecognizer.implementation.models.AnalyzeOperationResult;
import com.azure.ai.formrecognizer.implementation.models.ContentType;
import com.azure.ai.formrecognizer.models.ErrorInformation;
import com.azure.ai.formrecognizer.implementation.models.OperationStatus;
import com.azure.ai.formrecognizer.implementation.models.SourcePath;
import com.azure.ai.formrecognizer.models.ErrorInformation;
import com.azure.ai.formrecognizer.models.FormContentType;
import com.azure.ai.formrecognizer.models.FormPage;
import com.azure.ai.formrecognizer.models.FormRecognizerException;
import com.azure.ai.formrecognizer.models.OperationResult;
import com.azure.ai.formrecognizer.models.RecognizedForm;
import com.azure.ai.formrecognizer.models.RecognizedReceipt;
Expand Down Expand Up @@ -86,7 +87,7 @@ public final class FormRecognizerAsyncClient {
*
* @return A {@link PollerFlux} that polls the recognize custom form operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedForm}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code formUrl}, {@code modelId} is {@code null}.
*/
Expand All @@ -113,7 +114,7 @@ public final class FormRecognizerAsyncClient {
*
* @return A {@link PollerFlux} that polls the recognize custom form operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedForm}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code formUrl}, {@code modelId} is {@code null}.
*/
Expand Down Expand Up @@ -149,7 +150,7 @@ public final class FormRecognizerAsyncClient {
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedForm}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code form}, {@code modelId} is {@code null}.
*/
Expand Down Expand Up @@ -181,7 +182,7 @@ public final class FormRecognizerAsyncClient {
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedForm}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code form}, {@code modelId} is {@code null}.
*/
Expand Down Expand Up @@ -211,7 +212,7 @@ public final class FormRecognizerAsyncClient {
*
* @return A {@link PollerFlux} that polls the recognize custom form operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link FormPage}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code formUrl} is {@code null}.
*/
Expand All @@ -235,7 +236,7 @@ public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link FormPage}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code formUrl} is {@code null}.
*/
Expand Down Expand Up @@ -269,7 +270,7 @@ public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link FormPage}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code form} is {@code null}.
*/
Expand Down Expand Up @@ -299,7 +300,7 @@ public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContent(
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link FormPage}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code form} is {@code null}.
*/
Expand Down Expand Up @@ -328,7 +329,7 @@ public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContent(
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code receiptUrl} is {@code null}.
*/
Expand All @@ -354,7 +355,7 @@ public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContent(
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code receiptUrl} is {@code null}.
*/
Expand Down Expand Up @@ -388,7 +389,7 @@ public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContent(
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code receipt} is {@code null}.
*/
Expand Down Expand Up @@ -419,7 +420,7 @@ public PollerFlux<OperationResult, List<RecognizedReceipt>> beginRecognizeReceip
*
* @return A {@link PollerFlux} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code receipt} is {@code null}.
*/
Expand Down Expand Up @@ -595,7 +596,7 @@ private Function<PollingContext<OperationResult>, Mono<OperationResult>> content
}

/**
* Helper method that throws a {@link HttpResponseException} if {@link AnalyzeOperationResult#getStatus()} is
* Helper method that throws a {@link FormRecognizerException} if {@link AnalyzeOperationResult#getStatus()} is
* {@link OperationStatus#FAILED}.
*
* @param analyzeResponse The response returned from the service.
Expand All @@ -604,7 +605,7 @@ private void throwIfAnalyzeStatusInvalid(AnalyzeOperationResult analyzeResponse)
if (OperationStatus.FAILED.equals(analyzeResponse.getStatus())) {
List<ErrorInformation> errorInformationList = analyzeResponse.getAnalyzeResult().getErrors();
if (!CoreUtils.isNullOrEmpty(errorInformationList)) {
throw logger.logExceptionAsError(new HttpResponseException("Analyze operation failed.", null,
throw logger.logExceptionAsError(new FormRecognizerException("Analyze operation failed",
errorInformationList));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import com.azure.ai.formrecognizer.implementation.models.OperationStatus;
import com.azure.ai.formrecognizer.models.FormContentType;
import com.azure.ai.formrecognizer.models.FormPage;
import com.azure.ai.formrecognizer.models.FormRecognizerException;
import com.azure.ai.formrecognizer.models.OperationResult;
import com.azure.ai.formrecognizer.models.RecognizedForm;
import com.azure.ai.formrecognizer.models.RecognizedReceipt;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.util.polling.SyncPoller;
import reactor.core.publisher.Flux;

Expand Down Expand Up @@ -61,7 +61,7 @@ public final class FormRecognizerClient {
*
* @return A {@link SyncPoller} to poll the progress of the recognize custom form operation until it has completed,
* has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedForm}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code formUrl}, {@code modelId} is {@code null}.
*/
Expand All @@ -88,7 +88,7 @@ public final class FormRecognizerClient {
*
* @return A {@link SyncPoller} to poll the progress of the recognize custom form operation until it has completed,
* has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedForm}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code formUrl}, {@code modelId} is {@code null}.
*/
Expand Down Expand Up @@ -116,7 +116,7 @@ public final class FormRecognizerClient {
*
* @return A {@link SyncPoller} that polls the recognize custom form operation until it has completed,
* has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedForm}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code form}, {@code modelId} is {@code null}.
*/
Expand Down Expand Up @@ -145,7 +145,7 @@ public final class FormRecognizerClient {
*
* @return A {@link SyncPoller} that polls the recognize custom form operation until it has completed,
* has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedForm}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code form}, {@code modelId} is {@code null}.
*/
Expand All @@ -171,7 +171,7 @@ public final class FormRecognizerClient {
*
* @return A {@link SyncPoller} that polls the recognize layout form operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link FormPage}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code formUrl} is {@code null}.
*/
Expand All @@ -194,7 +194,7 @@ public SyncPoller<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link SyncPoller} that polls the recognize layout operation until it has completed, has
* failed, or has been cancelled. The completed operation returns a List of {@link FormPage}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code formUrl} is {@code null}.
*/
Expand All @@ -218,7 +218,7 @@ public SyncPoller<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link SyncPoller} that polls the recognize layout operation until it has completed, has failed, or has
* been cancelled. The completed operation returns a List of {@link FormPage}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code form} is {@code null}.
*/
Expand All @@ -245,7 +245,7 @@ public SyncPoller<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link SyncPoller} that polls the recognize layout operation until it has completed,
* has failed, or has been cancelled. The completed operation returns a List of {@link FormPage}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code form} is {@code null}.
*/
Expand All @@ -270,7 +270,7 @@ public SyncPoller<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link SyncPoller} to poll the progress of the recognize receipt operation until it has completed,
* has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code receiptUrl} is {@code null}.
*/
Expand All @@ -296,7 +296,7 @@ public SyncPoller<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link SyncPoller} to poll the progress of the recognize receipt operation until it has completed,
* has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code receiptUrl} is {@code null}.
*/
Expand All @@ -321,7 +321,7 @@ public SyncPoller<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link SyncPoller} that polls the recognize receipt operation until it has completed,
* has failed, or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code receipt} is {@code null}.
*/
Expand Down Expand Up @@ -349,7 +349,7 @@ public SyncPoller<OperationResult, List<FormPage>> beginRecognizeContentFromUrl(
*
* @return A {@link SyncPoller} that polls the recognize receipt operation until it has completed, has failed,
* or has been cancelled. The completed operation returns a List of {@link RecognizedReceipt}.
* @throws HttpResponseException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* @throws FormRecognizerException If recognize operation fails and the {@link AnalyzeOperationResult} returned with
* an {@link OperationStatus#FAILED}.
* @throws NullPointerException If {@code receipt} is {@code null}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;

/** The ErrorInformation model. */
@Fluent
public final class ErrorInformation {
public final class ErrorInformation implements Serializable {
private static final long serialVersionUID = -5217525992938366429L;

/*
* The code property.
*/
Expand Down
Loading