3.6.0 — 2025-07-29¶
← 3.6.1 | 3.5.2 → | ↑ 3.x series
New Features¶
gRPC Exception Interceptor System¶
- Centralized Exception Handling - Implemented comprehensive gRPC server exception interceptors for both synchronous
and asynchronous operations
- Added
GrpcServerExceptionInterceptorfor synchronous gRPC services with automatic exception conversion - Added
AsyncGrpcServerExceptionInterceptorfor asynchronous gRPC services with async exception handling - Eliminated the need for repetitive try-catch blocks in individual gRPC service methods
- Automatic conversion of exceptions to appropriate gRPC error responses with proper status codes
- Added
Enhanced Error Handling¶
- Pydantic Validation Error Handling - Integrated automatic Pydantic validation error processing in gRPC
interceptors
- Automatic conversion of ValidationError to InvalidArgumentError with detailed error information
- Structured validation error formatting with field-level error details
- Enhanced debugging capabilities with comprehensive validation error reporting
Language Configuration System¶
- Global Language Configuration - Added LANGUAGE configuration to BaseConfig for consistent language handling
- Introduced LANGUAGE attribute in BaseConfig with default Persian (FA) language support
- Standardized language type constants to uppercase for ISO compliance
- Improved language handling across error messages and user interfaces
Improvements¶
gRPC Status Code Management¶
- Enhanced Status Code Handling - Improved gRPC status code conversion and management in BaseError
- Added static method for converting integer status codes to gRPC StatusCode enums
- Enhanced metadata handling in gRPC abort methods with conditional additional data inclusion
- Refined type hints for context parameters in abort methods for better clarity
- Improved error context preservation and debugging capabilities
Error System Refactoring¶
- Optional Language Parameters - Refactored error handling classes to use optional language parameters
- Removed mandatory language parameter requirements for improved flexibility
- Enhanced error initialization with automatic language detection from global configuration
- Improved error message consistency and localization support
- Maintained backward compatibility while improving developer experience
Bug Fixes¶
Error Initialization¶
- Language Configuration Fix - Fixed language initialization in BaseError to use global configuration
- Ensured language is set correctly from global configuration when not provided during initialization
- Improved error message consistency across different initialization scenarios
- Enhanced code readability and maintainability
Type Safety Improvements¶
- Enhanced Type Hints - Improved type hints for gRPC status codes and error handling
- Refined type annotations for better IDE support and code reliability
- Enhanced type safety across error handling components
- Improved developer experience with better autocomplete and error detection
Code Quality¶
- Comprehensive Error Coverage - Updated all error classes to support the new language and gRPC handling system
- Enhanced auth_errors, business_errors, database_errors, network_errors, resource_errors, system_errors, and validation_errors
- Improved error categorization and handling consistency
- Enhanced error reporting and debugging capabilities across all error types