Skip to content

Commit cc83939

Browse files
committed
Minor refinement for consistency in error messages
1 parent 80e475b commit cc83939

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

emailproxy.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__author__ = 'Simon Robinson'
77
__copyright__ = 'Copyright (c) 2024 Simon Robinson'
88
__license__ = 'Apache 2.0'
9-
__package_version__ = '2025.2.4' # for pyproject.toml usage only - needs to be ast.literal_eval() compatible
9+
__package_version__ = '2025.3.5' # for pyproject.toml usage only - needs to be ast.literal_eval() compatible
1010
__version__ = '-'.join('%02d' % int(part) for part in __package_version__.split('.')) # ISO 8601 (YYYY-MM-DD)
1111

1212
import abc
@@ -823,8 +823,9 @@ def get_oauth2_credentials(username, password, reload_remote_accounts=True):
823823
# noinspection PyUnresolvedReferences
824824
import jwt
825825
except ImportError:
826-
return False, ('Unable to load jwt, which is a requirement when using certificate credentials '
827-
'(`jwt_` options). Please run `python -m pip install -r requirements-core.txt`')
826+
return (False, '%s: Unable to load jwt, which is a requirement when using certificate '
827+
'credentials (`jwt_` options). Please run `python -m pip install -r '
828+
'requirements-core.txt`' % APP_NAME)
828829
import uuid
829830
from cryptography import x509
830831
from cryptography.hazmat.primitives import serialization
@@ -848,8 +849,9 @@ def get_oauth2_credentials(username, password, reload_remote_accounts=True):
848849
'x5t#S256': base64.urlsafe_b64encode(jwt_certificate_fingerprint).decode('utf-8')
849850
})
850851
except (FileNotFoundError, OSError): # catch OSError due to GitHub issue 257 (quoted paths)
851-
return (False, 'Unable to create credentials assertion for account %s - please check that the '
852-
'`jwt_certificate_path` and `jwt_key_path` values are correct' % username)
852+
return (False, '%s: Unable to create credentials assertion for account %s - please check that '
853+
'the config file entry\'s `jwt_certificate_path` and `jwt_key_path` values are '
854+
'correct' % (APP_NAME, username))
853855

854856
if access_token or refresh_token: # if possible, refresh the existing token(s)
855857
if not access_token or access_token_expiry - current_time < TOKEN_EXPIRY_MARGIN:

0 commit comments

Comments
 (0)