Coverage for fastid / notify / exceptions.py: 100%
28 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-10-18 16:37 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-10-18 16:37 +0000
1from starlette import status
3from fastid.api.exceptions import ClientError
6class WrongCodeError(ClientError):
7 message = "Wrong code"
8 error_code = "wrong_code"
9 status_code = status.HTTP_400_BAD_REQUEST
12class TemplateNotFoundError(ClientError):
13 message = "Template with this name does not exist"
14 error_code = "template_not_found"
15 status_code = status.HTTP_404_NOT_FOUND
18class NoEmailError(ClientError):
19 message = "User with this id does not have any active email"
20 error_code = "no_email"
21 status_code = status.HTTP_400_BAD_REQUEST
24class NoTelegramIDError(ClientError):
25 message = "User with this id does not have any active telegram id"
26 error_code = "no_telegram_id"
27 status_code = status.HTTP_400_BAD_REQUEST
30class InvalidContactTypeError(ClientError):
31 message = "Invalid contact type"
32 error_code = "invalid_contact_type"
33 status_code = status.HTTP_400_BAD_REQUEST
36class MethodDisabledError(ClientError):
37 message = "Notification method is disabled. Enable it in settings to send notifications"
38 error_code = "notification_method_disabled"
39 status_code = status.HTTP_400_BAD_REQUEST
42class NotificationDisabledError(ClientError):
43 message = "Notifications are disabled. Enable at least one notification method to send notifications"
44 error_code = "notification_disabled"
45 status_code = status.HTTP_400_BAD_REQUEST