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

50 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2024-04-07 12:14 +0200

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 DebputySubstitutionError(DebputyRuntimeError): 

14 pass 

15 

16 

17class DebputyManifestVariableRequiresDebianDirError(DebputySubstitutionError): 

18 pass 

19 

20 

21class DebputyDpkgGensymbolsError(DebputyRuntimeError): 

22 pass 

23 

24 

25class SymlinkLoopError(ValueError): 

26 @property 

27 def message(self) -> str: 

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

29 

30 

31class PureVirtualPathError(TypeError): 

32 @property 

33 def message(self) -> str: 

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

35 

36 

37class TestPathWithNonExistentFSPathError(TypeError): 

38 @property 

39 def message(self) -> str: 

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

41 

42 

43class DebputyFSError(DebputyRuntimeError): 

44 pass 

45 

46 

47class DebputyFSIsROError(DebputyFSError): 

48 pass 

49 

50 

51class PluginBaseError(DebputyRuntimeError): 

52 pass 

53 

54 

55class DebputyPluginRuntimeError(PluginBaseError): 

56 pass 

57 

58 

59class PluginNotFoundError(PluginBaseError): 

60 pass 

61 

62 

63class PluginInitializationError(PluginBaseError): 

64 pass 

65 

66 

67class PluginMetadataError(PluginBaseError): 

68 pass 

69 

70 

71class PluginConflictError(PluginBaseError): 

72 @property 

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

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

75 

76 @property 

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

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

79 

80 

81class PluginAPIViolationError(PluginBaseError): 

82 pass 

83 

84 

85class UnhandledOrUnexpectedErrorFromPluginError(PluginBaseError): 

86 pass 

87 

88 

89class DebputyMetadataAccessError(DebputyPluginRuntimeError): 

90 pass