Files
orion/app/modules/prospecting/exceptions.py
Samir Boulahtit 6d6eba75bf
Some checks failed
CI / pytest (push) Failing after 48m31s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped
CI / ruff (push) Successful in 11s
CI / validate (push) Successful in 23s
CI / dependency-scanning (push) Successful in 28s
feat(prospecting): add complete prospecting module for lead discovery and scoring
Migrates scanning pipeline from marketing-.lu-domains app into Orion module.
Supports digital (domain scan) and offline (manual capture) lead channels
with enrichment, scoring, campaign management, and interaction tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 00:59:47 +01:00

81 lines
2.3 KiB
Python

# app/modules/prospecting/exceptions.py
"""
Prospecting module exceptions.
"""
from app.exceptions.base import (
BusinessLogicException,
ExternalServiceException,
ResourceNotFoundException,
)
class ProspectNotFoundException(ResourceNotFoundException): # noqa: MOD025
"""Raised when a prospect is not found."""
def __init__(self, identifier: str):
super().__init__(
resource_type="Prospect",
identifier=identifier,
)
class ScanJobNotFoundException(ResourceNotFoundException): # noqa: MOD025
"""Raised when a scan job is not found."""
def __init__(self, identifier: str):
super().__init__(
resource_type="ScanJob",
identifier=identifier,
)
class CampaignTemplateNotFoundException(ResourceNotFoundException): # noqa: MOD025
"""Raised when a campaign template is not found."""
def __init__(self, identifier: str):
super().__init__(
resource_type="CampaignTemplate",
identifier=identifier,
)
class DuplicateDomainException(BusinessLogicException): # noqa: MOD025
"""Raised when trying to create a prospect with a domain that already exists."""
def __init__(self, domain_name: str):
super().__init__(
message=f"A prospect with domain '{domain_name}' already exists",
error_code="DUPLICATE_DOMAIN",
)
class ScanFailedException(ExternalServiceException): # noqa: MOD025
"""Raised when an enrichment scan fails."""
def __init__(self, scan_type: str, domain: str, reason: str):
super().__init__(
message=f"{scan_type} scan failed for {domain}: {reason}",
service_name=f"prospecting_{scan_type}",
)
class CampaignRenderException(BusinessLogicException): # noqa: MOD025
"""Raised when campaign template rendering fails."""
def __init__(self, template_id: int, reason: str):
super().__init__(
message=f"Failed to render campaign template {template_id}: {reason}",
error_code="CAMPAIGN_RENDER_FAILED",
)
__all__ = [
"ProspectNotFoundException",
"ScanJobNotFoundException",
"CampaignTemplateNotFoundException",
"DuplicateDomainException",
"ScanFailedException",
"CampaignRenderException",
]