1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-16 17:47:23 +01:00

Fixed TRY003 (raise-vanilla-args): Avoid specifying long messages outside the exception class

This commit is contained in:
Teal Dulcet
2025-01-12 06:43:15 -08:00
parent 1d1a1a09c4
commit 08329c18cd
5 changed files with 18 additions and 6 deletions

View File

@@ -192,7 +192,9 @@ def get_passphrase(env):
backup_root = os.path.join(env["STORAGE_ROOT"], 'backup')
with open(os.path.join(backup_root, 'secret_key.txt'), encoding="utf-8") as f:
passphrase = f.readline().strip()
if len(passphrase) < 43: raise Exception("secret_key.txt's first line is too short!")
if len(passphrase) < 43:
msg = "secret_key.txt's first line is too short!"
raise Exception(msg)
return passphrase