diff --git a/pyjsonrpc/rpcerror.py b/pyjsonrpc/rpcerror.py index fe224c8..9f2e608 100644 --- a/pyjsonrpc/rpcerror.py +++ b/pyjsonrpc/rpcerror.py @@ -31,7 +31,7 @@ def __init__(self, message = None, data = None, code = None): self.message = message or self.message self.data = data self.code = code or self.code - assert self.code, "Error without code is not allowed." + assert self.code is not None, "Error without code is not allowed." def __str__(self): return "JsonRpcError({code}): {message}".format( diff --git a/pyjsonrpc/rpcresponse.py b/pyjsonrpc/rpcresponse.py index fdfc5f5..f0a34e9 100644 --- a/pyjsonrpc/rpcresponse.py +++ b/pyjsonrpc/rpcresponse.py @@ -20,7 +20,7 @@ def __init__(self, code, message, data): """ :param code: Error code :param message: Error message - :param data: Additional error informations + :param data: Additional error information """ Bunch.__init__(self) @@ -29,7 +29,7 @@ def __init__(self, code, message, data): self.data = data def __len__(self): - return 1 if self.code else 0 + return 0 if (self.code is None) or (self.message is None) else 1 def __init__(