Add IOError custom message when rsa key file is missing.

This commit is contained in:
juanifioren 2015-07-14 15:01:01 -03:00
parent 211f942eec
commit 1736d7b7ae

View file

@ -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