@@ -71,10 +71,10 @@ public EventKind sendMessage(MessageSendParams messageSendParams) throws A2AServ
7171 } else if (response .hasTask ()) {
7272 return FromProto .task (response .getTask ());
7373 } else {
74- throw new A2AServerException ("Failed to send message: " );
74+ throw new A2AServerException ("Server response did not contain a message or task " );
7575 }
7676 } catch (StatusRuntimeException e ) {
77- throw new A2AServerException ("Failed to send message: " + e , e . getCause () );
77+ throw new A2AServerException ("Failed to send message: " + e , e );
7878 }
7979 }
8080
@@ -95,7 +95,7 @@ public Task getTask(TaskQueryParams taskQueryParams) throws A2AServerException {
9595 try {
9696 return FromProto .task (blockingStub .getTask (getTaskRequest ));
9797 } catch (StatusRuntimeException e ) {
98- throw new A2AServerException ("Failed to get task: " + e , e . getCause () );
98+ throw new A2AServerException ("Failed to get task: " + e , e );
9999 }
100100 }
101101
@@ -113,7 +113,7 @@ public Task cancelTask(TaskIdParams taskIdParams) throws A2AServerException {
113113 try {
114114 return FromProto .task (blockingStub .cancelTask (cancelTaskRequest ));
115115 } catch (StatusRuntimeException e ) {
116- throw new A2AServerException ("Failed to cancel task: " + e , e . getCause () );
116+ throw new A2AServerException ("Failed to cancel task: " + e , e );
117117 }
118118 }
119119
@@ -125,13 +125,16 @@ public Task cancelTask(TaskIdParams taskIdParams) throws A2AServerException {
125125 * @throws A2AServerException if setting the push notification configuration fails for any reason
126126 */
127127 public TaskPushNotificationConfig setTaskPushNotificationConfig (TaskPushNotificationConfig taskPushNotificationConfig ) throws A2AServerException {
128+ String configId = taskPushNotificationConfig .pushNotificationConfig ().id ();
128129 CreateTaskPushNotificationConfigRequest request = CreateTaskPushNotificationConfigRequest .newBuilder ()
130+ .setParent ("tasks/" + taskPushNotificationConfig .taskId ())
129131 .setConfig (ToProto .taskPushNotificationConfig (taskPushNotificationConfig ))
132+ .setConfigId (configId == null ? "" : configId )
130133 .build ();
131134 try {
132135 return FromProto .taskPushNotificationConfig (blockingStub .createTaskPushNotificationConfig (request ));
133136 } catch (StatusRuntimeException e ) {
134- throw new A2AServerException ("Failed to set the task push notification config: " + e , e . getCause () );
137+ throw new A2AServerException ("Failed to set the task push notification config: " + e , e );
135138 }
136139 }
137140
@@ -149,7 +152,7 @@ public TaskPushNotificationConfig getTaskPushNotificationConfig(GetTaskPushNotif
149152 try {
150153 return FromProto .taskPushNotificationConfig (blockingStub .getTaskPushNotificationConfig (getTaskPushNotificationConfigRequest ));
151154 } catch (StatusRuntimeException e ) {
152- throw new A2AServerException ("Failed to get the task push notification config: " + e , e . getCause () );
155+ throw new A2AServerException ("Failed to get the task push notification config: " + e , e );
153156 }
154157 }
155158
@@ -168,7 +171,7 @@ public void sendMessageStreaming(MessageSendParams messageSendParams, Consumer<S
168171 try {
169172 asyncStub .sendStreamingMessage (request , streamObserver );
170173 } catch (StatusRuntimeException e ) {
171- throw new A2AServerException ("Failed to send streaming message: " + e , e . getCause () );
174+ throw new A2AServerException ("Failed to send streaming message: " + e , e );
172175 }
173176 }
174177
@@ -189,7 +192,7 @@ private String getTaskPushNotificationConfigName(GetTaskPushNotificationConfigPa
189192 name .append ("tasks/" );
190193 name .append (getTaskPushNotificationConfigParams .id ());
191194 if (getTaskPushNotificationConfigParams .pushNotificationConfigId () != null ) {
192- name .append ("pushNotification /" );
195+ name .append ("/pushNotificationConfigs /" );
193196 name .append (getTaskPushNotificationConfigParams .pushNotificationConfigId ());
194197 }
195198 return name .toString ();
0 commit comments