Skip to content

Commit 43618f0

Browse files
authored
Merge branch '1.0-dev' into ishymko/cleanup
2 parents 2a03251 + c41fd93 commit 43618f0

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/a2a/server/request_handlers/default_request_handler.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
from a2a.utils.errors import (
5050
InternalError,
5151
InvalidParamsError,
52+
PushNotificationNotSupportedError,
5253
TaskNotCancelableError,
5354
TaskNotFoundError,
5455
UnsupportedOperationError,
@@ -493,7 +494,7 @@ async def on_create_task_push_notification_config(
493494
Requires a `PushNotifier` to be configured.
494495
"""
495496
if not self._push_config_store:
496-
raise UnsupportedOperationError
497+
raise PushNotificationNotSupportedError
497498

498499
task_id = params.task_id
499500
task: Task | None = await self.task_store.get(task_id, context)
@@ -519,7 +520,7 @@ async def on_get_task_push_notification_config(
519520
Requires a `PushConfigStore` to be configured.
520521
"""
521522
if not self._push_config_store:
522-
raise UnsupportedOperationError
523+
raise PushNotificationNotSupportedError
523524

524525
task_id = params.task_id
525526
config_id = params.id
@@ -594,7 +595,7 @@ async def on_list_task_push_notification_configs(
594595
Requires a `PushConfigStore` to be configured.
595596
"""
596597
if not self._push_config_store:
597-
raise UnsupportedOperationError
598+
raise PushNotificationNotSupportedError
598599

599600
task_id = params.task_id
600601
task: Task | None = await self.task_store.get(task_id, context)
@@ -620,7 +621,7 @@ async def on_delete_task_push_notification_config(
620621
Requires a `PushConfigStore` to be configured.
621622
"""
622623
if not self._push_config_store:
623-
raise UnsupportedOperationError
624+
raise PushNotificationNotSupportedError
624625

625626
task_id = params.task_id
626627
config_id = params.id

tests/server/request_handlers/test_default_request_handler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from a2a.types import (
3939
InternalError,
4040
InvalidParamsError,
41+
PushNotificationNotSupportedError,
4142
TaskNotCancelableError,
4243
TaskNotFoundError,
4344
UnsupportedOperationError,
@@ -1838,7 +1839,7 @@ async def test_set_task_push_notification_config_no_notifier():
18381839
url='http://example.com',
18391840
)
18401841

1841-
with pytest.raises(UnsupportedOperationError):
1842+
with pytest.raises(PushNotificationNotSupportedError):
18421843
await request_handler.on_create_task_push_notification_config(
18431844
params, create_server_call_context()
18441845
)
@@ -1885,7 +1886,7 @@ async def test_get_task_push_notification_config_no_store():
18851886
id='task_push_notification_config',
18861887
)
18871888

1888-
with pytest.raises(UnsupportedOperationError):
1889+
with pytest.raises(PushNotificationNotSupportedError):
18891890
await request_handler.on_get_task_push_notification_config(
18901891
params, create_server_call_context()
18911892
)
@@ -2116,7 +2117,7 @@ async def test_list_task_push_notification_config_no_store():
21162117
)
21172118
params = ListTaskPushNotificationConfigsRequest(task_id='task1')
21182119

2119-
with pytest.raises(UnsupportedOperationError):
2120+
with pytest.raises(PushNotificationNotSupportedError):
21202121
await request_handler.on_list_task_push_notification_configs(
21212122
params, create_server_call_context()
21222123
)
@@ -2261,11 +2262,10 @@ async def test_delete_task_push_notification_config_no_store():
22612262
task_id='task1', id='config1'
22622263
)
22632264

2264-
with pytest.raises(UnsupportedOperationError) as exc_info:
2265+
with pytest.raises(PushNotificationNotSupportedError):
22652266
await request_handler.on_delete_task_push_notification_config(
22662267
params, create_server_call_context()
22672268
)
2268-
assert isinstance(exc_info.value, UnsupportedOperationError)
22692269

22702270

22712271
@pytest.mark.asyncio

0 commit comments

Comments
 (0)