aeat.adapters.outbound.aeat.browser._errors module

Shared exception types for AEAT browser adapters.

The browser adapter wraps Playwright launch, context creation, evasion, navigation, site-health, and teardown failures in BrowserError with a stable BrowserFailureMode. That mode is copied into the structured context mapping so CLI and workflow error renderers can classify failures without parsing message text.

See also

adapters.outbound.aeat.browser.BrowserSession

Central owner that emits these browser errors.

adapters.outbound.aeat.browser.EvasionStrategy

Strategy hook whose setup failures surface as BrowserEvasionError.

adapters.outbound.aeat.browser.SiteHealthStatus

Site-health record carried separately by core.errors.SiteHealthError when AEAT itself returns a classified non-OK response.

exception BrowserError(message=None, *, failure_mode=None, context=None, suggestion=None, translated_message=None)[source]

Bases: AeatError

Base class for browser-related failures.

failure_mode may be a BrowserFailureMode member or an existing string value. When supplied, it is stored both on self.failure_mode and under context["failure_mode"] so downstream callers can branch on one stable tag.

Parameters:
Return type:

None

code: ClassVar[ErrorCode]
exception BrowserValidationError(message=None, *, failure_mode=None, context=None, suggestion=None, translated_message=None)[source]

Bases: BrowserError, ValueError

Raised when browser parameters or field values fail domain validation.

This error inherits from both BrowserError and ValueError, ensuring compatibility with Pydantic’s validator contract while remaining catchable under the package’s unified error hierarchy.

Parameters:
Return type:

None

code: ClassVar[ErrorCode]
exception BrowserEvasionError(message=None, *, failure_mode=None, context=None, suggestion=None, translated_message=None)[source]

Bases: BrowserError

Raised when browser evasion setup cannot be applied.

PlaywrightStealthEvasion raises this when playwright-stealth is unavailable. Failures that occur while BrowserSession applies any strategy are wrapped with BrowserFailureMode.EVASION_FAILED.

Parameters:
Return type:

None

code: ClassVar[ErrorCode]
class BrowserFailureMode(*values)[source]

Bases: StrEnum

Closed browser-backend failure modes emitted by the central session.

BrowserSession uses these values for one-live-context enforcement, browser launch, context creation, evasion, provider annotation, page-content reads, navigation transport failures, site-health classifications, and retained browser close failures.

SESSION_BUSY
BROWSER_LAUNCH_FAILED
CONTEXT_CREATE_FAILED
EVASION_FAILED
CONTEXT_ANNOTATION_FAILED
PAGE_CONTENT_FAILED
NAVIGATION_TIMEOUT
NAVIGATION_TRANSPORT_ERROR
SITE_HEALTH_NON_OK
BROWSER_CLOSE_FAILED