aeat.adapters.outbound.google._errors module

Typed exception hierarchy for the Google OAuth Desktop integration.

Every subclass is an core.errors.AeatError with a stable core.errors.ErrorCode declared in the adapter error registry. That keeps the public CLI taxonomy explicit while entrypoints.cli._config._google_errors can map concrete GoogleAuthError subclasses to localised refusal text. Constructors carry structured remediation context (context={...}) so renderers can surface actionable guidance without leaking the secret material handled by adapters.outbound.google._oauth_flow.

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

Bases: AeatError

Base class for every Google OAuth Desktop authentication failure.

Catch this at CLI boundaries that need one Google-auth refusal arm while preserving the concrete core.errors.ErrorCode on each leaf.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when input parameters fail validation.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when no Cloud Console Desktop OAuth client is registered for the active profile.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when the operator (or Google) revoked the registered Desktop OAuth client.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when the refresh token was revoked (e.g. via myaccount.google.com).

Maps to Google’s invalid_grant response with error_description="Token has been expired or revoked.".

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when a Testing-project refresh token has aged past Google’s 7-day cap.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when the granted scope set does not include every scope required by the call site.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when the OAuth or token endpoint is unreachable (DNS, TLS, timeout, refused).

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when the loopback HTTP receiver cannot bind a local port.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when the OS-default browser launcher fails to open the consent URL.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when the interactive browser consent flow is attempted without a controlling terminal.

The Desktop OAuth flow opens the consent screen in a browser and then blocks a loopback HTTP receiver until the operator completes consent. With no controlling TTY (a piped, redirected, or detached invocation) no operator can complete the flow, so the receiver would block forever. This refusal fails fast instead, naming the interactive-terminal prerequisite.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised on OAuth attempts under aeat_secret_store_backend=unsecured with a real NIF profile.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when the OS keychain backing the secret store is locked or unreachable.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: GoogleAuthError

Raised when Google auth cannot resolve the active AEAT profile.

Emitted by adapters.outbound.google._active_profile.resolve_active_profile() and profile-loading guards in adapters.outbound.google._oauth_flow.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]