-
-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Description
Description
There is no way to handle exceptions if request does not pass "id" attribute. JSONRPCResponseManager.handle() should always return a response with an error in case of exception in user code or if it is not possible, there should be an argument to enable this (strict) behavior.
Steps to Reproduce
Run this code:
import jsonrpc
dispatcher = jsonrpc.Dispatcher()
@dispatcher.add_method
def test():
1/0
request = '{"jsonrpc": "2.0", "method": "test", "params": []}'
print(jsonrpc.JSONRPCResponseManager.handle(request, dispatcher))Expected behavior: error response should be printed
Actual behavior: None is printed
Reproduces how often: always
Versions
all
Additional Information
If you change request to '{"jsonrpc": "2.0", "method": "test", "params": [], "id": 1}' it expectedly returns response with an error:
{'jsonrpc': '2.0', 'id': 1, 'error': {'message': 'Server error', 'code': -32000, 'data': {'message': 'integer division or modulo by zero', 'args': ('integer division or modulo by zero',), 'type': 'ZeroDivisionError'}}}Metadata
Metadata
Assignees
Labels
No labels