blob: 3c30011432184b01ae94762bd09e950e0af29e82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
from django.core.exceptions import ImproperlyConfigured
class InvalidMailer(ImproperlyConfigured):
"""A settings.MAILERS entry has a configuration error."""
def __init__(self, msg, *, alias=None):
if alias is not None:
msg = f"MAILERS[{alias!r}]: {msg}"
super().__init__(msg)
class MailerDoesNotExist(InvalidMailer, KeyError):
"""The requested alias is not defined in settings.MAILERS."""
def __init__(self, *, alias):
# This is the only permitted use for this exception.
super().__init__(f"The mailer '{alias}' is not configured.")
|