Skip to content

Commit

Permalink
Reraise snappy.UncompressError
Browse files Browse the repository at this point in the history
  • Loading branch information
gliptak authored Feb 5, 2024
1 parent bebe035 commit 2f74908
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/snappy/snappy.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ def compress(data, encoding='utf-8'):
def uncompress(data, decoding=None):
if isinstance(data, unicode):
raise UncompressError("It's only possible to uncompress bytes")
try:
out = bytes(_uncompress(data))
except cramjam.DecompressionError as err:
raise UncompressError from err
if decoding:
return bytes(_uncompress(data)).decode(decoding)
return bytes(_uncompress(data))
return out.decode(decoding)
return out


decompress = uncompress

Expand Down

0 comments on commit 2f74908

Please sign in to comment.