Coverage for src/debputy/exceptions.py: 93%

56 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2025-01-27 13:59 +0000

1from typing import cast, TYPE_CHECKING 

2 

3if TYPE_CHECKING: 

4 from debputy.plugin.api.impl_types import DebputyPluginMetadata 

5 

6 

7class DebputyRuntimeError(RuntimeError): 

8 @property 

9 def message(self) -> str: 

10 return cast("str", self.args[0]) 

11 

12 

13class DebputyRuntimeErrorWithPreamble(DebputyRuntimeError): 

14 

15 def render_preamble(self) -> None: 

16 raise NotImplementedError 

17 

18 

19class DebputyBuildStepError(DebputyRuntimeError): 

20 pass 

21 

22 

23class DebputySubstitutionError(DebputyRuntimeError): 

24 pass 

25 

26 

27class DebputyManifestVariableRequiresDebianDirError(DebputySubstitutionError): 

28 pass 

29 

30 

31class DebputyDpkgGensymbolsError(DebputyRuntimeError): 

32 pass 

33 

34 

35class SymlinkLoopError(ValueError): 

36 @property 

37 def message(self) -> str: 

38 return cast("str", self.args[0]) 

39 

40 

41class PureVirtualPathError(TypeError): 

42 @property 

43 def message(self) -> str: 

44 return cast("str", self.args[0]) 

45 

46 

47class TestPathWithNonExistentFSPathError(TypeError): 

48 @property 

49 def message(self) -> str: 

50 return cast("str", self.args[0]) 

51 

52 

53class DebputyFSError(DebputyRuntimeError): 

54 pass 

55 

56 

57class DebputyFSIsROError(DebputyFSError): 

58 pass 

59 

60 

61class PluginBaseError(DebputyRuntimeError): 

62 pass 

63 

64 

65class DebputyPluginRuntimeError(PluginBaseError): 

66 pass 

67 

68 

69class PluginNotFoundError(PluginBaseError): 

70 pass 

71 

72 

73class PluginInitializationError(PluginBaseError): 

74 pass 

75 

76 

77class PluginIncorrectRegistrationError(PluginInitializationError): 

78 pass 

79 

80 

81class PluginMetadataError(PluginBaseError): 

82 pass 

83 

84 

85class PluginConflictError(PluginBaseError): 

86 @property 

87 def plugin_a(self) -> "DebputyPluginMetadata": 

88 return cast("DebputyPluginMetadata", self.args[1]) 

89 

90 @property 

91 def plugin_b(self) -> "DebputyPluginMetadata": 

92 return cast("DebputyPluginMetadata", self.args[2]) 

93 

94 

95class PluginAPIViolationError(PluginBaseError): 

96 pass 

97 

98 

99class UnhandledOrUnexpectedErrorFromPluginError(PluginBaseError): 

100 pass 

101 

102 

103class DebputyMetadataAccessError(DebputyPluginRuntimeError): 

104 pass