Skip to content

Commit

Permalink
Use 'from' when handle charset decoding error
Browse files Browse the repository at this point in the history
  • Loading branch information
ahawker committed Aug 25, 2020
1 parent 971c277 commit 888b087
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ulid/base32.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def str_to_bytes(value: str, expected_length: int) -> bytes:
try:
encoded = value.encode('ascii')
except UnicodeEncodeError as ex:
raise ValueError('Expects value that can be encoded in ASCII charset: {}'.format(ex))
raise ValueError('Expects value that can be encoded in ASCII charset: {}'.format(ex)) from ex

decoding = DECODING

Expand Down

0 comments on commit 888b087

Please sign in to comment.