Source code for certbot.errors

"""Certbot client errors."""
from typing import Set
from typing import TYPE_CHECKING

    from certbot.achallenges import AnnotatedChallenge

[docs]class Error(Exception): """Generic Certbot client error."""
[docs]class AccountStorageError(Error): """Generic `.AccountStorage` error."""
[docs]class AccountNotFound(AccountStorageError): """Account not found error."""
[docs]class ReverterError(Error): """Certbot Reverter error."""
[docs]class SubprocessError(Error): """Subprocess handling error."""
[docs]class CertStorageError(Error): """Generic `.CertStorage` error."""
[docs]class HookCommandNotFound(Error): """Failed to find a hook command in the PATH."""
[docs]class SignalExit(Error): """A Unix signal was received while in the ErrorHandler context manager."""
[docs]class OverlappingMatchFound(Error): """Multiple lineages matched what should have been a unique result."""
[docs]class LockError(Error): """File locking error."""
# Auth Handler Errors
[docs]class AuthorizationError(Error): """Authorization error."""
[docs]class FailedChallenges(AuthorizationError): """Failed challenges error. :ivar set failed_achalls: Failed `.AnnotatedChallenge` instances. """ def __init__(self, failed_achalls: Set['AnnotatedChallenge']) -> None: assert failed_achalls self.failed_achalls = failed_achalls super().__init__() def __str__(self) -> str: return "Failed authorization procedure. {0}".format( ", ".join( "{0} ({1}): {2}".format(achall.domain, achall.typ, achall.error) for achall in self.failed_achalls if achall.error is not None))
# Plugin Errors
[docs]class PluginError(Error): """Certbot Plugin error."""
[docs]class PluginEnhancementAlreadyPresent(Error): """ Enhancement was already set """
[docs]class PluginSelectionError(Error): """A problem with plugin/configurator selection or setup"""
[docs]class NoInstallationError(PluginError): """Certbot No Installation error."""
[docs]class MisconfigurationError(PluginError): """Certbot Misconfiguration error."""
[docs]class NotSupportedError(PluginError): """Certbot Plugin function not supported error."""
[docs]class PluginStorageError(PluginError): """Certbot Plugin Storage error."""
[docs]class StandaloneBindError(Error): """Standalone plugin bind error.""" def __init__(self, socket_error: OSError, port: int) -> None: super().__init__( "Problem binding to port {0}: {1}".format(port, socket_error)) self.socket_error = socket_error self.port = port
[docs]class ConfigurationError(Error): """Configuration sanity error."""
# NoninteractiveDisplay error:
[docs]class MissingCommandlineFlag(Error): """A command line argument was missing in noninteractive usage"""