Skip to content

Errors

email_profile.core.errors

Custom exceptions raised by the public API.

ConnectionFailure

Bases: Exception

Raised when the IMAP login fails.

Source code in email_profile/core/errors.py
 6
 7
 8
 9
10
class ConnectionFailure(Exception):
    """Raised when the IMAP login fails."""

    def __init__(self) -> None:
        super().__init__("Failed to connect to email server.")

__init__()

Source code in email_profile/core/errors.py
 9
10
def __init__(self) -> None:
    super().__init__("Failed to connect to email server.")

IMAPError

Bases: Exception

Raised when the IMAP server returns a non-OK status.

Source code in email_profile/core/errors.py
30
31
class IMAPError(Exception):
    """Raised when the IMAP server returns a non-OK status."""

NotConnected

Bases: RuntimeError

Raised when a connection-bound method is called too early.

Source code in email_profile/core/errors.py
13
14
15
16
17
18
19
class NotConnected(RuntimeError):
    """Raised when a connection-bound method is called too early."""

    def __init__(self) -> None:
        super().__init__(
            "Email client is not connected. Call .connect() or use a `with` block."
        )

__init__()

Source code in email_profile/core/errors.py
16
17
18
19
def __init__(self) -> None:
    super().__init__(
        "Email client is not connected. Call .connect() or use a `with` block."
    )

QuotaExceeded

Bases: Exception

Raised when the server reports the account is over its storage quota.

Source code in email_profile/core/errors.py
22
23
class QuotaExceeded(Exception):
    """Raised when the server reports the account is over its storage quota."""

RateLimited

Bases: Exception

Raised when the server reports a bandwidth or rate limit hit.

Source code in email_profile/core/errors.py
26
27
class RateLimited(Exception):
    """Raised when the server reports a bandwidth or rate limit hit."""

Retryable

Bases: Exception

Raised when an operation hit a transient failure worth retrying.

Source code in email_profile/core/errors.py
34
35
class Retryable(Exception):
    """Raised when an operation hit a transient failure worth retrying."""

email_profile.providers.ProviderResolutionError

Bases: RuntimeError

Raised when no IMAP host can be discovered for an address.

Source code in email_profile/providers.py
28
29
class ProviderResolutionError(RuntimeError):
    """Raised when no IMAP host can be discovered for an address."""