From 1736d7b7aed3ce3049186ce97e24941de0187caf Mon Sep 17 00:00:00 2001 From: juanifioren Date: Tue, 14 Jul 2015 15:01:01 -0300 Subject: [PATCH] Add IOError custom message when rsa key file is missing. --- oidc_provider/lib/utils/common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/oidc_provider/lib/utils/common.py b/oidc_provider/lib/utils/common.py index 3905231..c3565ec 100644 --- a/oidc_provider/lib/utils/common.py +++ b/oidc_provider/lib/utils/common.py @@ -22,7 +22,10 @@ def get_rsa_key(): Load the rsa key previously created with `creatersakey` command. """ file_path = settings.get('OIDC_RSA_KEY_FOLDER') + '/OIDC_RSA_KEY.pem' - with open(file_path, 'r') as f: - key = f.read() + try: + with open(file_path, 'r') as f: + key = f.read() + except IOError: + raise IOError('We could not find your key file on: ' + file_path) return key