Closed nicola-lunghi closed 4 years ago
I have the following code:
async def my_func(): payload = '{"jsonrpc":"2.0","method":"connect", "arguments": ["wifi_c8df844b53ae_62756d626c656265652d323539373835_managed_psk"], "id":"aaaaaaqvjcYf5A0h"}' response = await jrpc_dispatch(payload.decode(), debug=True) @method async def connect(): # do something
here I use wrongly "arguments" for the argument list
I got the exception
my_test[1101]: ERROR: Task exception was never retrieved my_test[1101]: future: <Task finished coro=<process_rpc_message() done, defined at /usr/lib/python3.7/site-packages/test_mqtt/mqttrpc.py:12> exception=TypeError("__init__() got an unexpected keyword argument 'arguments'")> [asyncio:default_exception_handler:1615] my_test[1101]: Traceback (most recent call last): my_test[1101]: File "/usr/lib/python3.7/site-packages/test_mqtt/mqttrpc.py", line 13, in process_rpc_message my_test[1101]: response = await jrpc_dispatch(payload.decode(), debug=True) my_test[1101]: File "/usr/lib/python3.7/site-packages/jsonrpcserver/async_dispatcher.py", line 101, in dispatch my_test[1101]: convert_camel_case=convert_camel_case, my_test[1101]: File "/usr/lib/python3.7/site-packages/jsonrpcserver/async_dispatcher.py", line 71, in dispatch_pure my_test[1101]: deserialized, context=context, convert_camel_case=convert_camel_case my_test[1101]: File "/usr/lib/python3.7/site-packages/jsonrpcserver/dispatcher.py", line 201, in create_requests my_test[1101]: return Request(context=context, convert_camel_case=convert_camel_case, **requests) my_test[1101]: TypeError: __init__() got an unexpected keyword argument 'arguments'
~This seems correct to me, what are you expecting to happen?~
Ok it should return a JSON-RPC error, not raise an exception -- fixed by @deptyped in #128 .
I have the following code:
here I use wrongly "arguments" for the argument list
I got the exception