jsonrpc: Explain why call to private method failed
This commit is contained in:
parent
253695222b
commit
609fdc46ca
@ -206,9 +206,10 @@ class JsonRpcWrapper(object):
|
||||
mount, method_name = method_path.rsplit('.', 1)
|
||||
else:
|
||||
mount, method_name = '', method_path
|
||||
if method_name.startswith('_'):
|
||||
raise JsonRpcMethodNotFoundError(
|
||||
data='Private methods are not exported')
|
||||
try:
|
||||
if method_name.startswith('_'):
|
||||
raise AttributeError
|
||||
obj = self.objects[mount]
|
||||
return getattr(obj, method_name)
|
||||
except (AttributeError, KeyError):
|
||||
|
||||
@ -405,6 +405,7 @@ class JsonRpcSingleCommandErrorTest(JsonRpcTestBase):
|
||||
error = response['error']
|
||||
self.assertEqual(error['code'], -32601)
|
||||
self.assertEqual(error['message'], 'Method not found')
|
||||
self.assertEqual(error['data'], 'Private methods are not exported')
|
||||
|
||||
def test_invalid_params_causes_invalid_params_error(self):
|
||||
request = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user