Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Spec incompliance: the truth of the error object should not depend on… #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyjsonrpc/rpcerror.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions pyjsonrpc/rpcresponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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__(
Expand Down