From 888b0870d640c77dace49899fa4ea5c470cc73c6 Mon Sep 17 00:00:00 2001 From: Andrew Hawker Date: Mon, 24 Aug 2020 17:01:51 -0700 Subject: [PATCH] Use 'from' when handle charset decoding error --- ulid/base32.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ulid/base32.py b/ulid/base32.py index 83d734d..0966078 100644 --- a/ulid/base32.py +++ b/ulid/base32.py @@ -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