Files
mail-intake/mail_intake/exceptions.py
Vishesh 'ironeagle' Bangotra f22af90e98 docs(mail_intake): add comprehensive docstrings across ingestion, adapters, auth, and parsing layers
- docs(mail_intake/__init__.py): document module-based public API and usage patterns
- docs(mail_intake/ingestion/reader.py): document high-level ingestion orchestration
- docs(mail_intake/adapters/base.py): document adapter contract for mail providers
- docs(mail_intake/adapters/gmail.py): document Gmail adapter implementation and constraints
- docs(mail_intake/auth/base.py): document authentication provider contract
- docs(mail_intake/auth/google.py): document Google OAuth authentication provider
- docs(mail_intake/models/message.py): document canonical email message model
- docs(mail_intake/models/thread.py): document canonical email thread model
- docs(mail_intake/parsers/body.py): document message body extraction logic
- docs(mail_intake/parsers/headers.py): document message header normalization utilities
- docs(mail_intake/parsers/subject.py): document subject normalization utilities
- docs(mail_intake/config.py): document global configuration model
- docs(mail_intake/exceptions.py): document library exception hierarchy
2026-01-09 17:40:25 +05:30

50 lines
1.3 KiB
Python

"""
Exception hierarchy for Mail Intake.
This module defines the **canonical exception types** used throughout the
Mail Intake library.
All library-raised errors derive from `MailIntakeError`. Consumers are
encouraged to catch this base type (or specific subclasses) rather than
provider-specific or third-party exceptions.
"""
class MailIntakeError(Exception):
"""
Base exception for all Mail Intake errors.
This is the root of the Mail Intake exception hierarchy.
All errors raised by the library must derive from this class.
Consumers should generally catch this type when handling
library-level failures.
"""
class MailIntakeAuthError(MailIntakeError):
"""
Authentication and credential-related failures.
Raised when authentication providers are unable to acquire,
refresh, or persist valid credentials.
"""
class MailIntakeAdapterError(MailIntakeError):
"""
Errors raised by mail provider adapters.
Raised when a provider adapter encounters API errors,
transport failures, or invalid provider responses.
"""
class MailIntakeParsingError(MailIntakeError):
"""
Errors encountered while parsing message content.
Raised when raw provider payloads cannot be interpreted
or normalized into internal domain models.
"""