pylightning: raise Error when missing rpc parameter

This commit is contained in:
Conor Scott 2019-02-21 16:37:05 +04:00 committed by Christian Decker
parent 6ed54dd34e
commit d96564ce3e

View file

@ -194,6 +194,9 @@ class Plugin(object):
if pos < len(params): if pos < len(params):
# Apply positional args if we have them # Apply positional args if we have them
arguments[k] = params[pos] arguments[k] = params[pos]
elif sig.parameters[k].default is inspect.Signature.empty:
# This is a positional arg with no value passed
raise TypeError("Missing required parameter: %s" % sig.parameters[k])
else: else:
# For the remainder apply default args # For the remainder apply default args
arguments[k] = sig.parameters[k].default arguments[k] = sig.parameters[k].default