Skip to content

Commit 36b730a

Browse files
committed
SDK-1076: Add error source back to crypto file read method
1 parent 6cdbfa2 commit 36b730a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

yoti_python_sdk/crypto.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def strip_pkcs5_padding(data):
7070
return stripped
7171

7272
@staticmethod
73-
def read_pem_file(key_file_path):
73+
def read_pem_file(key_file_path, error_source=None):
7474
try:
7575
key_file_path = expanduser(key_file_path)
7676

@@ -80,6 +80,8 @@ def read_pem_file(key_file_path):
8080
with open(key_file_path, "rb") as pem_file:
8181
return Crypto(pem_file.read().strip())
8282
except (AttributeError, IOError, TypeError, OSError) as exc:
83-
error = "Could not read private key file: '{0}'".format(key_file_path)
83+
error = "Could not read private key file: '{0}', passed as: {1}".format(
84+
key_file_path, error_source
85+
)
8486
exception = "{0}: {1}".format(type(exc).__name__, exc)
8587
raise RuntimeError("{0}: {1}".format(error, exception))

0 commit comments

Comments
 (0)