File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -999,6 +999,7 @@ class A2AError(
999999 | UnsupportedOperationError
10001000 | ContentTypeNotSupportedError
10011001 | InvalidAgentResponseError
1002+ | JSONRPCError
10021003 ]
10031004):
10041005 root : (
@@ -1013,6 +1014,7 @@ class A2AError(
10131014 | UnsupportedOperationError
10141015 | ContentTypeNotSupportedError
10151016 | InvalidAgentResponseError
1017+ | JSONRPCError
10161018 )
10171019 """
10181020 A discriminated union of all standard JSON-RPC and A2A-specific error types.
Original file line number Diff line number Diff line change @@ -1487,8 +1487,14 @@ def test_a2a_error_validation_and_serialization() -> None:
14871487 a2a_err_content = A2AError .model_validate (content_type_err_data )
14881488 assert isinstance (a2a_err_content .root , ContentTypeNotSupportedError )
14891489
1490- # 11. Test invalid data (doesn't match any known error code/structure)
1491- invalid_data : dict [str , Any ] = {'code' : - 99999 , 'message' : 'Unknown error' }
1490+ # 11. Test JSONRPCError
1491+ json_rpc_err_instance = JSONRPCError (code = 1234 , message = 'Generic error' )
1492+ json_rpc_err_data = json_rpc_err_instance .model_dump (exclude_none = True )
1493+ a2a_err_content = A2AError .model_validate (json_rpc_err_data )
1494+ assert isinstance (a2a_err_content .root , JSONRPCError )
1495+
1496+ # 12. Test invalid data (doesn't match any known error code/structure)
1497+ invalid_data : dict [str , Any ] = {'code' : - 99999 , 'messages' : 'Unknown error' }
14921498 with pytest .raises (ValidationError ):
14931499 A2AError .model_validate (invalid_data )
14941500
You can’t perform that action at this time.
0 commit comments