You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 865a15b
Browse filesBrowse the repository at this point in the historyBrowse files
fix(gax): propagate structured LRO error details to ApiException (#14022)
### Description:
When a Long-Running Operation (LRO) completes with a failure, structured
error details inside the operation's error payload were previously
dropped. This made it impossible for client applications to access
fine-grained provider error messages (such as quota or usage violations)
via the public `ApiException.getErrorDetails()` API.
This PR implements **Phase 1** of the LRO error propagation design by
establishing the transport-agnostic mechanism to propagate structured
LRO error details in GAX for both gRPC and HTTP/JSON (REST) transports.
Design doc:
[go/sdk:java-lro-error-details](http://goto.google.com/sdk:java-lro-error-details)
### Key Changes:
1. **Core GAX Interfaces**:
- Added support to fetch structured error details from the LRO operation
snapshots.
2. **gRPC Transport**:
- Implemented error details extraction from LRO operation error payloads
(only populated if structured error details are present).
- Updated the gRPC response transformer to pass these error details when
converting failed operations into exception objects.
- Added unit test validation checking details propagation for LRO
failures over gRPC.
3. **HTTP/JSON (REST) Transport**:
- Implemented error details extraction and storage in REST LRO operation
snapshots (only populated if structured error details are present).
- Updated the REST response transformer to fetch and pass the snapshot's
error details.
- Added unit test validation checking details propagation for LRO
failures over HTTP/JSON.
5. **Integration & Unit Testing**:
- Added a Showcase integration test verifying successful end-to-end
propagation of error details over gRPC.
- **Note on HTTP/JSON Integration Test**: Deferring the end-to-end
Showcase integration test for HTTP/JSON LROs to **Phase 2** because
HTTP/JSON relies on a `TypeRegistry` in generated stubs to parse
custom/standard payload types packed in `Any` details, the test client
fails to deserialize these details. Once we roll out the generator
changes in Phase 2 to automatically add error details types to generated
stub registries, the Showcase REST integration test will pass
out-of-the-box. We have added unit tests to cover the HTTP/JSON LRO
response parsing pathway in the interim.
### Testing:
- Verified that all gRPC and HTTP/JSON transformer unit tests pass
successfully:
`mvn test -pl
sdk-platform-java/gax-java/gax-grpc,sdk-platform-java/gax-java/gax-httpjson
-Dtest=ProtoOperationTransformersTest`
- Verified that the Showcase LRO integration test passes successfully:
`mvn test -pl java-showcase/gapic-showcase
-Dtest=ITLongRunningOperation`
Copy file name to clipboardExpand all lines: sdk-platform-java/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/ProtoOperationTransformersTest.java
Copy file name to clipboardExpand all lines: sdk-platform-java/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/HttpJsonOperationSnapshot.java
Copy file name to clipboardExpand all lines: sdk-platform-java/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/ProtoOperationTransformers.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,8 @@ public ResponseT apply(OperationSnapshot operationSnapshot) {
63
63
+ operationSnapshot.getErrorMessage(),
64
64
null,
65
65
operationSnapshot.getErrorCode(),
66
-
false);
66
+
false,
67
+
operationSnapshot.getErrorDetails());
67
68
}
68
69
69
70
if (!(operationSnapshot.getResponse() instanceofAny)) {
Copy file name to clipboardExpand all lines: sdk-platform-java/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpJsonOperationSnapshotTest.java
Copy file name to clipboardExpand all lines: sdk-platform-java/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/ProtoOperationTransformersTest.java
0 commit comments