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
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public void listTaskPushNotificationConfigs(org.a2aproject.sdk.grpc.ListTaskPush
*
* <p><b>Error Handling:</b>
* <ul>
* <li>Streaming not enabled → {@link org.a2aproject.sdk.spec.InvalidRequestError}</li>
* <li>Streaming not enabled → {@link org.a2aproject.sdk.spec.UnsupportedOperationError}</li>
* <li>Other {@link A2AError} → mapped to appropriate gRPC status code</li>
* <li>{@link SecurityException} → {@code UNAUTHENTICATED} or {@code PERMISSION_DENIED}</li>
* <li>{@link Throwable} → {@code INTERNAL} error</li>
Expand All @@ -388,7 +388,8 @@ public void listTaskPushNotificationConfigs(org.a2aproject.sdk.grpc.ListTaskPush
public void sendStreamingMessage(org.a2aproject.sdk.grpc.SendMessageRequest request,
StreamObserver<org.a2aproject.sdk.grpc.StreamResponse> responseObserver) {
if (!getAgentCardInternal().capabilities().streaming()) {
handleError(responseObserver, new InvalidRequestError());
handleError(responseObserver,
new UnsupportedOperationError(null, "Streaming is not supported by the agent", null));
return;
}

Expand All @@ -413,7 +414,8 @@ public void sendStreamingMessage(org.a2aproject.sdk.grpc.SendMessageRequest requ
public void subscribeToTask(org.a2aproject.sdk.grpc.SubscribeToTaskRequest request,
StreamObserver<org.a2aproject.sdk.grpc.StreamResponse> responseObserver) {
if (!getAgentCardInternal().capabilities().streaming()) {
handleError(responseObserver, new InvalidRequestError());
handleError(responseObserver,
new UnsupportedOperationError(null, "Streaming is not supported by the agent", null));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ public void testStreamingNotSupportedError() throws Exception {
AgentCard card = AbstractA2ARequestHandlerTest.createAgentCard(false, true);
GrpcHandler handler = new TestGrpcHandler(card, requestHandler, internalExecutor);
StreamRecorder<StreamResponse> streamRecorder = sendStreamingMessageRequest(handler);
assertGrpcError(streamRecorder, Status.Code.INVALID_ARGUMENT);
assertGrpcError(streamRecorder, Status.Code.UNIMPLEMENTED);
}

@Test
Expand All @@ -639,7 +639,7 @@ public void testStreamingNotSupportedErrorOnSubscribeToTask() throws Exception {
StreamRecorder<StreamResponse> streamRecorder = StreamRecorder.create();
handler.subscribeToTask(request, streamRecorder);
streamRecorder.awaitCompletion(5, TimeUnit.SECONDS);
assertGrpcError(streamRecorder, Status.Code.INVALID_ARGUMENT);
assertGrpcError(streamRecorder, Status.Code.UNIMPLEMENTED);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.a2aproject.sdk.spec.ExtendedAgentCardNotConfiguredError;
import org.a2aproject.sdk.spec.EventKind;
import org.a2aproject.sdk.spec.InternalError;
import org.a2aproject.sdk.spec.InvalidRequestError;
import org.a2aproject.sdk.spec.UnsupportedOperationError;
import org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsResult;
import org.a2aproject.sdk.spec.PushNotificationNotSupportedError;
Expand Down Expand Up @@ -283,7 +282,7 @@ public Flow.Publisher<SendStreamingMessageResponse> onMessageSendStream(
return ZeroPublisher.fromItems(
new SendStreamingMessageResponse(
request.getId(),
new InvalidRequestError("Streaming is not supported by the agent")));
new UnsupportedOperationError(null, "Streaming is not supported by the agent", null)));
}

try {
Expand Down Expand Up @@ -380,7 +379,7 @@ public Flow.Publisher<SendStreamingMessageResponse> onSubscribeToTask(
return ZeroPublisher.fromItems(
new SendStreamingMessageResponse(
request.getId(),
new InvalidRequestError("Streaming is not supported by the agent")));
new UnsupportedOperationError(null, "Streaming is not supported by the agent", null)));
}
requestHandler.authorizeTaskAccess(request.getParams().id(), context, TaskOperation.SUBSCRIBE_TO_TASK);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import org.a2aproject.sdk.spec.ExtensionSupportRequiredError;
import org.a2aproject.sdk.spec.GetTaskPushNotificationConfigParams;
import org.a2aproject.sdk.spec.InternalError;
import org.a2aproject.sdk.spec.InvalidRequestError;
import org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsParams;
import org.a2aproject.sdk.spec.ListTasksParams;
import org.a2aproject.sdk.spec.Message;
Expand Down Expand Up @@ -1047,7 +1046,7 @@ public void onComplete() {
});

assertEquals(1, results.size());
if (results.get(0).getError() != null && results.get(0).getError() instanceof InvalidRequestError ire) {
if (results.get(0).getError() != null && results.get(0).getError() instanceof UnsupportedOperationError ire) {
assertEquals("Streaming is not supported by the agent", ire.getMessage());
} else {
fail("Expected a response containing an error");
Expand Down Expand Up @@ -1094,7 +1093,7 @@ public void onComplete() {
});

assertEquals(1, results.size());
if (results.get(0).getError() != null && results.get(0).getError() instanceof InvalidRequestError ire) {
if (results.get(0).getError() != null && results.get(0).getError() instanceof UnsupportedOperationError ire) {
assertEquals("Streaming is not supported by the agent", ire.getMessage());
} else {
fail("Expected a response containing an error");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public HTTPRestResponse sendMessage(ServerCallContext context, String tenant, St
public HTTPRestResponse sendStreamingMessage(ServerCallContext context, String tenant, String body) {
try {
if (!agentCard.capabilities().streaming()) {
return createErrorResponse(new InvalidRequestError("Streaming is not supported by the agent"));
return createErrorResponse(new UnsupportedOperationError(null, "Streaming is not supported by the agent", null));
}
A2AVersionValidator.validateProtocolVersion(agentCard, context);
A2AExtensions.validateRequiredExtensions(agentCard, context);
Expand Down Expand Up @@ -425,7 +425,7 @@ public HTTPRestResponse createTaskPushNotificationConfiguration(ServerCallContex
public HTTPRestResponse subscribeToTask(ServerCallContext context, String tenant, String taskId) {
try {
if (!agentCard.capabilities().streaming()) {
return createErrorResponse(new InvalidRequestError("Streaming is not supported by the agent"));
return createErrorResponse(new UnsupportedOperationError(null, "Streaming is not supported by the agent", null));
}
TaskIdParams params = TaskIdParams.builder().id(taskId).tenant(tenant).build();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public void testSendStreamingMessageNotSupported() {
RestHandler.HTTPRestResponse response = handler.sendStreamingMessage(callContext, "", requestBody);

assertProblemDetail(response, 400,
"INVALID_REQUEST",
"UNSUPPORTED_OPERATION",
"Streaming is not supported by the agent");
}

Expand Down
Loading