flux_local.exceptions
Exceptions related to flux-local.
1"""Exceptions related to flux-local.""" 2 3__all__ = [ 4 "FluxException", 5 "InputException", 6 "CommandException", 7] 8 9 10class FluxException(Exception): 11 """Generic base exception used for this library.""" 12 13 14class InputException(FluxException): 15 """Raised when the input files or values are not formatted as expected.""" 16 17 18class CommandException(FluxException): 19 """Raised when there is a failure running a subcommand.""" 20 21 22class KustomizeException(CommandException): 23 """Raised when there is a failure running a kustomize command.""" 24 25 26class KustomizePathException(KustomizeException): 27 """Raised a Kustomization points to a path that does not exist.""" 28 29 30class ResourceFailedError(FluxException): 31 """Raised when a resource reconciliation has failed and is in a terminal state.""" 32 33 def __init__(self, resource_name: str, message: str | None) -> None: 34 super().__init__( 35 f"Resource {resource_name} failed: {message or 'Unknown error'}" 36 ) 37 self.resource_name = resource_name 38 self.message = message 39 40 41class DependencyFailedError(InputException): 42 """Raised when a Kustomization dependency has failed.""" 43 44 def __init__( 45 self, 46 kustomization_id: str, 47 dependency_id: str, 48 dependency_error: str | None, 49 ): 50 self.kustomization_id = kustomization_id 51 self.dependency_id = dependency_id 52 self.dependency_error = dependency_error 53 super().__init__( 54 f"Kustomization {kustomization_id} dependency {dependency_id} failed: " 55 f"{dependency_error or 'Unknown error'}" 56 ) 57 58 59class ObjectNotFoundError(FluxException): 60 """Raised when an object is not found in the store.""" 61 62 63class HelmException(CommandException): 64 """Raised when there is a failure running a helm command.""" 65 66 67class InvalidValuesReference(FluxException): 68 """Exception raised for an unsupported ValuesReference.""" 69 70 71class InvalidSubstituteReference(FluxException): 72 """Exception raised for an unsupported SubstituteReference."""
class
FluxException(builtins.Exception):
Generic base exception used for this library.
15class InputException(FluxException): 16 """Raised when the input files or values are not formatted as expected."""
Raised when the input files or values are not formatted as expected.
19class CommandException(FluxException): 20 """Raised when there is a failure running a subcommand."""
Raised when there is a failure running a subcommand.