Coverage for opt/mealie/lib/python3.12/site-packages/mealie/core/exceptions.py: 100%
18 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-11-25 15:48 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-11-25 15:48 +0000
1from sqlite3 import IntegrityError 1a
3from mealie.lang.providers import Translator 1a
6class UnexpectedNone(Exception): 1a
7 """Exception raised when a value is None when it should not be."""
9 def __init__(self, message: str = "Unexpected None Value"): 1a
10 self.message = message 1bc
11 super().__init__(self.message) 1bc
13 def __str__(self): 1a
14 return f"{self.message}" 1bc
17class PermissionDenied(Exception): 1a
18 """
19 This exception is raised when a user tries to access a resource that they do not have permission to access.
20 """
22 pass 1a
25class SlugError(Exception): 1a
26 """
27 This exception is raised when the recipe name generates an invalid slug.
28 """
30 pass 1a
33class NoEntryFound(Exception): 1a
34 """
35 This exception is raised when a user tries to access a resource that does not exist.
36 """
38 pass 1a
41def mealie_registered_exceptions(t: Translator) -> dict: 1a
42 """
43 This function returns a dictionary of all the globally registered exceptions in the Mealie application.
44 """
46 return { 1dbefghijklmnopc
47 PermissionDenied: t.t("exceptions.permission-denied"),
48 NoEntryFound: t.t("exceptions.no-entry-found"),
49 IntegrityError: t.t("exceptions.integrity-error"),
50 }
53class UserLockedOut(Exception): ... 1a
56class MissingClaimException(Exception): ... 1a