Coverage for src/debputy/exceptions.py: 92%
66 statements
« prev ^ index » next coverage.py v7.8.2, created at 2026-01-26 19:30 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2026-01-26 19:30 +0000
1"""Exceptions with basic type annotations for accessors and constructors."""
3from typing import Any, cast, TYPE_CHECKING
5if TYPE_CHECKING:
6 from debputy.plugin.api.impl_types import DebputyPluginMetadata
9class DebputyRuntimeError(RuntimeError):
11 def __init__(self, message: str, *args: Any) -> None:
12 super().__init__(message, *args)
14 @property
15 def message(self) -> str:
16 return cast("str", self.args[0])
19class DebputyRuntimeErrorWithPreamble(DebputyRuntimeError):
21 def render_preamble(self) -> None:
22 raise NotImplementedError
25class DebputyBuildStepError(DebputyRuntimeError):
26 pass
29class DebputySubstitutionError(DebputyRuntimeError):
30 pass
33class DebputyManifestVariableRequiresDebianDirError(DebputySubstitutionError):
34 pass
37class DebputyDpkgGensymbolsError(DebputyRuntimeError):
38 pass
41class SymlinkLoopError(ValueError):
43 def __init__(self, message: str, *args: Any) -> None:
44 super().__init__(message, *args)
46 @property
47 def message(self) -> str:
48 return cast("str", self.args[0])
51class PureVirtualPathError(TypeError):
53 def __init__(self, message: str, *args: Any) -> None:
54 super().__init__(message, *args)
56 @property
57 def message(self) -> str:
58 return cast("str", self.args[0])
61class TestPathWithNonExistentFSPathError(TypeError):
63 def __init__(self, message: str, *args: Any) -> None:
64 super().__init__(message, *args)
66 @property
67 def message(self) -> str:
68 return cast("str", self.args[0])
71class DebputyFSError(DebputyRuntimeError):
72 pass
75class DebputyFSIsROError(DebputyFSError):
76 pass
79class PluginBaseError(DebputyRuntimeError):
80 pass
83class DebputyPluginRuntimeError(PluginBaseError):
84 pass
87class PluginNotFoundError(PluginBaseError):
88 pass
91class PluginInitializationError(PluginBaseError):
92 pass
95class PluginIncorrectRegistrationError(PluginInitializationError):
96 pass
99class PluginMetadataError(PluginBaseError):
100 pass
103class PluginConflictError(PluginBaseError):
105 def __init__(
106 self,
107 message: str,
108 plugin_a: "DebputyPluginMetadata",
109 plugin_b: "DebputyPluginMetadata",
110 *args: Any,
111 ) -> None:
112 super().__init__(message, plugin_a, plugin_b, *args)
114 @property
115 def plugin_a(self) -> "DebputyPluginMetadata":
116 return cast("DebputyPluginMetadata", self.args[1])
118 @property
119 def plugin_b(self) -> "DebputyPluginMetadata":
120 return cast("DebputyPluginMetadata", self.args[2])
123class PluginAPIViolationError(PluginBaseError):
124 pass
127class UnhandledOrUnexpectedErrorFromPluginError(PluginBaseError):
128 pass
131class DebputyMetadataAccessError(DebputyPluginRuntimeError):
132 pass