Source code for smarter.apps.infrastructure.exceptions

"""
Exceptions of the infrastructure app.

The platform catches these, never a cloud provider's own exceptions: each provider translates
its SDK's errors into them.
"""

from smarter.common.exceptions import SmarterException


[docs] class SmarterInfrastructureError(SmarterException): """Base class of the infrastructure app's exceptions."""
[docs] class InfrastructureConfigurationError(SmarterInfrastructureError): """ An infrastructure service is misconfigured, or is refused in the unit tests. The real cloud and cluster credentials of the Smarter containers can create billable resources, so the real services refuse to run in the unit tests unless they are asked to. """
[docs] class InfrastructureNotReadyError(SmarterInfrastructureError): """An infrastructure service is not authenticated, or not connected."""
[docs] class InfrastructureResourceNotFound(SmarterInfrastructureError): """An infrastructure resource, e.g. a DNS zone or a certificate, does not exist."""
[docs] class InfrastructureTimeout(SmarterInfrastructureError): """An infrastructure resource did not reach the expected state in time."""
[docs] class DNSServiceError(SmarterInfrastructureError): """The DNS service failed."""
[docs] class DNSZoneNotFound(DNSServiceError, InfrastructureResourceNotFound): """A DNS zone does not exist."""
[docs] class DNSRecordTimeout(DNSServiceError, InfrastructureTimeout): """A DNS record did not appear in its zone in time."""
[docs] class CertificateServiceError(SmarterInfrastructureError): """The certificate service failed."""
[docs] class CertificateNotFound(CertificateServiceError, InfrastructureResourceNotFound): """A certificate does not exist."""
[docs] class CertificateNotIssued(CertificateServiceError): """A certificate exists, but is not issued."""
[docs] class CertificateTimeout(CertificateServiceError, InfrastructureTimeout): """A certificate was not issued, or its validation records were not generated, in time."""
[docs] class KubernetesServiceError(SmarterInfrastructureError): """The Kubernetes cluster is unavailable, or rejected a request."""
[docs] class EmailServiceError(SmarterInfrastructureError): """The email service is misconfigured."""
__all__ = [ "CertificateNotFound", "CertificateNotIssued", "CertificateServiceError", "CertificateTimeout", "DNSRecordTimeout", "DNSServiceError", "DNSZoneNotFound", "EmailServiceError", "InfrastructureConfigurationError", "InfrastructureNotReadyError", "InfrastructureResourceNotFound", "InfrastructureTimeout", "KubernetesServiceError", "SmarterInfrastructureError", ]