Skip to content

Commit

Permalink
Applies only serialization to catch exceptions
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Best <[email protected]>
  • Loading branch information
cassiobotaro and spaceone authored Nov 4, 2021
1 parent d074a7b commit 1ecad6a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class JSONSerializer:
raise SerializationError(obj)

def loads(self, data: bytes) -> dict:
data = data.split(NULL_BYTE, 1)[0]
try:
data = data.split(NULL_BYTE, 1)[0]
return json.loads(data)
except json.JSONDecodeError:
raise DeserializationError(data)
Expand Down
2 changes: 1 addition & 1 deletion shared_memory_dict/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def dumps(self, obj: dict) -> bytes:
raise SerializationError(obj)

def loads(self, data: bytes) -> dict:
data = data.split(NULL_BYTE, 1)[0]
try:
data = data.split(NULL_BYTE, 1)[0]
return json.loads(data)
except json.JSONDecodeError:
raise DeserializationError(data)
Expand Down

0 comments on commit 1ecad6a

Please sign in to comment.