Coverage for src / lexigram / contracts / exceptions / __init__.py: 0%

15 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-15 18:57 +0800

1"""Canonical exception classes for Lexigram Framework. 

2 

3This module contains the single source of truth for all framework exceptions. 

4All exceptions inherit from LexigramError, ensuring isinstance checks work 

5across core, events, web, and all subpackages. 

6 

7Architecture: 

8- base.py: LexigramError (root) 

9- domain.py: Domain-level errors (NotFoundError, ValidationError, etc.) 

10- infra.py: Infrastructure errors (DatabaseError, etc.) 

11- container.py: DI container errors 

12- resilience.py: Resilience pattern errors 

13- provider.py: Provider/module errors 

14- events.py: Event bus/messaging errors 

15""" 

16 

17from __future__ import annotations 

18 

19from lexigram.contracts.exceptions.base import LexigramError 

20from lexigram.contracts.exceptions.config import ConfigurationError 

21from lexigram.contracts.exceptions.container import ( 

22 CircularDependencyError, 

23 ContainerBuildError, 

24 ContainerError, 

25 ContainerValidationError, 

26 DependencyError, 

27 ProtocolValidationError, 

28 RegistrationError, 

29 ScopedResolutionError, 

30 UnresolvableDependencyError, 

31) 

32from lexigram.contracts.exceptions.domain import ( 

33 AuthenticationError, 

34 AuthorizationError, 

35 ConflictError, 

36 DomainError, 

37 FieldError, 

38 MappingError, 

39 NotFoundError, 

40 PermissionDeniedError, 

41 RateLimitError, 

42 SerializationError, 

43 ValidationError, 

44 WebError, 

45) 

46from lexigram.contracts.exceptions.events import ( 

47 DuplicateHandlerError, 

48 EventError, 

49 HandlerNotFoundError, 

50) 

51from lexigram.contracts.exceptions.execution import ( 

52 PipelineExecutionError, 

53 PipelineStepError, 

54) 

55from lexigram.contracts.exceptions.feature_flags import ( 

56 FeatureFlagError, 

57) 

58from lexigram.contracts.exceptions.idempotency import ( 

59 DuplicateRequestError, 

60 IdempotencyConflictError, 

61 IdempotencyError, 

62 IdempotencyStoreError, 

63) 

64from lexigram.contracts.exceptions.infra import ( 

65 ConstraintError, 

66 DatabaseError, 

67 DuplicateKeyError, 

68 InfrastructureError, 

69 IntegrityError, 

70 LockConflictError, 

71 LockError, 

72 MigrationError, 

73 RegistryAlreadyExistsError, 

74 RegistryError, 

75 RegistryKeyError, 

76) 

77from lexigram.contracts.exceptions.middleware import MiddlewareGuardError 

78from lexigram.contracts.exceptions.provider import ( 

79 ModuleError, 

80 ProviderError, 

81) 

82from lexigram.contracts.exceptions.resilience import ( 

83 BulkheadError, 

84 CircuitBreakerError, 

85 CircuitOpenError, 

86 FallbackError, 

87 ResilienceError, 

88 RetryError, 

89 RetryExhaustedError, 

90) 

91from lexigram.contracts.exceptions.security import ( 

92 CORSViolationError, 

93 GuardDeniedError, 

94 InputSanitizationError, 

95 SecretAccessError, 

96 SecurityError, 

97) 

98 

99__all__ = [ 

100 "AuthenticationError", 

101 "AuthorizationError", 

102 "BulkheadError", 

103 "CORSViolationError", 

104 "CircuitBreakerError", 

105 "CircuitOpenError", 

106 "CircularDependencyError", 

107 "ConfigurationError", 

108 "ConflictError", 

109 "ConstraintError", 

110 "ContainerBuildError", 

111 "ContainerError", 

112 "ContainerValidationError", 

113 "DatabaseError", 

114 "DependencyError", 

115 "DomainError", 

116 "DuplicateHandlerError", 

117 "DuplicateKeyError", 

118 "DuplicateRequestError", 

119 "EventError", 

120 "FallbackError", 

121 "FeatureFlagError", 

122 "FieldError", 

123 "GuardDeniedError", 

124 "HandlerNotFoundError", 

125 "IdempotencyConflictError", 

126 "IdempotencyError", 

127 "IdempotencyStoreError", 

128 "InfrastructureError", 

129 "InputSanitizationError", 

130 "IntegrityError", 

131 "LexigramError", 

132 "LockConflictError", 

133 "LockError", 

134 "MappingError", 

135 "MiddlewareGuardError", 

136 "MigrationError", 

137 "ModuleError", 

138 "NotFoundError", 

139 "PermissionDeniedError", 

140 "PipelineExecutionError", 

141 "PipelineStepError", 

142 "ProtocolValidationError", 

143 "ProviderError", 

144 "RateLimitError", 

145 "RegistrationError", 

146 "RegistryAlreadyExistsError", 

147 "RegistryError", 

148 "RegistryKeyError", 

149 "ResilienceError", 

150 "RetryError", 

151 "RetryExhaustedError", 

152 "ScopedResolutionError", 

153 "SecretAccessError", 

154 "SecurityError", 

155 "SerializationError", 

156 "UnresolvableDependencyError", 

157 "ValidationError", 

158 "WebError", 

159]