1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-08 16:27:24 +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

@@ -86,7 +86,9 @@ def migration_7(env):
if newemail != email:
c = conn.cursor()
c.execute("UPDATE aliases SET source=? WHERE source=?", (newemail, email))
if c.rowcount != 1: raise ValueError("Alias not found.")
if c.rowcount != 1:
msg = "Alias not found."
raise ValueError(msg)
print("Updated alias", email, "to", newemail)
except Exception as e:
print("Error updating IDNA alias", email, e)