Coverage for netrun_errors \ __init__.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-11-25 19:24 -0800

1""" 

2Netrun Unified Error Handling Package. 

3 

4A comprehensive error handling library for FastAPI applications with: 

5- Structured JSON error responses 

6- Automatic correlation ID generation 

7- Machine-readable error codes 

8- Global exception handlers 

9- Request/response logging middleware 

10 

11Version: 1.0.0 

12Author: Netrun Systems 

13License: MIT 

14""" 

15 

16__version__ = "1.0.0" 

17 

18# Base exception 

19from .base import NetrunException 

20 

21# Authentication exceptions 

22from .auth import ( 

23 AuthenticationRequiredError, 

24 InvalidCredentialsError, 

25 TokenExpiredError, 

26 TokenInvalidError, 

27 TokenRevokedError, 

28) 

29 

30# Authorization exceptions 

31from .authorization import InsufficientPermissionsError, TenantAccessDeniedError 

32 

33# Resource exceptions 

34from .resource import ResourceConflictError, ResourceNotFoundError 

35 

36# Service exceptions 

37from .service import ServiceUnavailableError, TemporalUnavailableError 

38 

39# Exception handlers 

40from .handlers import install_exception_handlers 

41 

42# Middleware 

43from .middleware import install_error_logging_middleware 

44 

45__all__ = [ 

46 # Base 

47 "NetrunException", 

48 # Authentication 

49 "InvalidCredentialsError", 

50 "TokenExpiredError", 

51 "TokenInvalidError", 

52 "TokenRevokedError", 

53 "AuthenticationRequiredError", 

54 # Authorization 

55 "InsufficientPermissionsError", 

56 "TenantAccessDeniedError", 

57 # Resource 

58 "ResourceNotFoundError", 

59 "ResourceConflictError", 

60 # Service 

61 "ServiceUnavailableError", 

62 "TemporalUnavailableError", 

63 # Handlers 

64 "install_exception_handlers", 

65 # Middleware 

66 "install_error_logging_middleware", 

67]