]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Remove try/except + test
authorClemens Rieder <68914047+clemensrieder@users.noreply.github.com>
Thu, 12 Jan 2023 08:36:55 +0000 (09:36 +0100)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Mon, 16 Jan 2023 21:49:54 +0000 (13:49 -0800)
Changes in d064ff5 made try/except unnecessary and the subsequent test failed.

src/paperless_mail/mail.py
src/paperless_mail/tests/test_mail.py

index 4031f26d0e549c8ae4caf6a34561b8670b9fd5e0..04caca63c4c1f48d7b55bed5d5cdc1b68d546ffb 100644 (file)
@@ -92,18 +92,13 @@ class TagMailAction(BaseMailAction):
 
         # The custom tag should look like "apple:<color>"
         if "apple:" in parameter.lower():
-            try:
-                _, self.color = parameter.split(":")
-                self.color = self.color.strip()
 
-                if not self.color.lower() in APPLE_MAIL_TAG_COLORS.keys():
-                    raise MailError("Not a valid AppleMail tag color.")
-            except Exception as e:
-                raise MailError(
-                    """Could not parse parameters.
-                    Make sure they look like this: apple:<color> and
-                    only use allowed colors.""",
-                ) from e
+            _, self.color = parameter.split(":")
+            self.color = self.color.strip()
+
+            if not self.color.lower() in APPLE_MAIL_TAG_COLORS.keys():
+                raise MailError("Not a valid AppleMail tag color.")
+
             self.keyword = None
 
         else:
index 309e846d4caaf9ca8bfd276474f47a09b25b2031..cd10018612c20d4726338d9f83d1793b7d0ae91f 100644 (file)
@@ -682,11 +682,6 @@ class TestMail(DirectoriesMixin, TestCase):
             TagMailAction,
             "apple:black",
         )
-        self.assertRaises(
-            MailError,
-            TagMailAction,
-            "applegreen",
-        )
 
     def test_handle_mail_account_tag_applemail(self):
         # all mails will be FLAGGED afterwards