55"""
66
77
8- class A2AException (Exception ):
8+ class A2AError (Exception ):
99 """Base exception for A2A errors."""
1010
1111 message : str = 'A2A Error'
@@ -16,54 +16,81 @@ def __init__(self, message: str | None = None):
1616 super ().__init__ (self .message )
1717
1818
19- class TaskNotFoundError (A2AException ):
19+ class TaskNotFoundError (A2AError ):
20+ """Exception raised when a task is not found."""
21+
2022 message = 'Task not found'
2123
2224
23- class TaskNotCancelableError (A2AException ):
25+ class TaskNotCancelableError (A2AError ):
26+ """Exception raised when a task cannot be canceled."""
27+
2428 message = 'Task cannot be canceled'
2529
2630
27- class PushNotificationNotSupportedError (A2AException ):
31+ class PushNotificationNotSupportedError (A2AError ):
32+ """Exception raised when push notifications are not supported."""
33+
2834 message = 'Push Notification is not supported'
2935
3036
31- class UnsupportedOperationError (A2AException ):
37+ class UnsupportedOperationError (A2AError ):
38+ """Exception raised when an operation is not supported."""
39+
3240 message = 'This operation is not supported'
3341
3442
35- class ContentTypeNotSupportedError (A2AException ):
43+ class ContentTypeNotSupportedError (A2AError ):
44+ """Exception raised when the content type is incompatible."""
45+
3646 message = 'Incompatible content types'
3747
3848
39- class InternalError (A2AException ):
49+ class InternalError (A2AError ):
50+ """Exception raised for internal server errors."""
51+
4052 message = 'Internal error'
4153
4254
43- class InvalidAgentResponseError (A2AException ):
55+ class InvalidAgentResponseError (A2AError ):
56+ """Exception raised when the agent response is invalid."""
57+
4458 message = 'Invalid agent response'
4559
4660
47- class AuthenticatedExtendedCardNotConfiguredError (A2AException ):
61+ class AuthenticatedExtendedCardNotConfiguredError (A2AError ):
62+ """Exception raised when the authenticated extended card is not configured."""
63+
4864 message = 'Authenticated Extended Card is not configured'
4965
5066
51- class InvalidParamsError (A2AException ):
67+ class InvalidParamsError (A2AError ):
68+ """Exception raised when parameters are invalid."""
69+
5270 message = 'Invalid params'
5371
5472
55- class InvalidRequestError (A2AException ):
73+ class InvalidRequestError (A2AError ):
74+ """Exception raised when the request is invalid."""
75+
5676 message = 'Invalid Request'
5777
5878
59- class MethodNotFoundError (A2AException ):
79+ class MethodNotFoundError (A2AError ):
80+ """Exception raised when a method is not found."""
81+
6082 message = 'Method not found'
6183
6284
85+ # For backward compatibility
86+ A2AException = A2AError
87+
88+
6389# For backward compatibility if needed, or just aliases for clean refactor
6490# We remove the Pydantic models here.
6591
6692__all__ = [
93+ 'A2AError' ,
6794 'A2AException' ,
6895 'A2AServerError' ,
6996 'AuthenticatedExtendedCardNotConfiguredError' ,
0 commit comments