Skip to content

v0.0.2 - Enhanced Exception Handling and Auto-Initialization

Choose a tag to compare

@kenerwin88 kenerwin88 released this 09 Sep 18:04
· 19 commits to main since this release
032f6b6

馃殌 Major Features

Enhanced Exception Handling

  • Enhanced handle_exceptions function with optional custom error messages
  • Support for both message keys and direct strings in error handling
  • Automatic localization fallback when message keys are not found
  • Comprehensive unit tests for exception handling scenarios

Automatic Message Manager Initialization

  • Added auto_initialize_messages configuration option to Config class
  • Automatic MessageManager initialization with locale from Lex request
  • Eliminates need for manual initialize_message_manager() calls in Lambda functions
  • Graceful error handling for MessageManager initialization failures

Automatic Exception Handling in Lambda Functions

  • Added auto_handle_exceptions configuration option to Config class
  • Automatic exception handling and error response generation
  • Custom error message configuration via error_message parameter
  • Eliminates need for try/catch blocks in Lambda functions
  • Maintains proper Lex response formatting for all error scenarios

Message Consistency Testing Framework

  • Comprehensive test suite for message key consistency across locales
  • Validates all YAML message files have identical keys
  • Parameter consistency validation for message templates
  • Placeholder detection to prevent incomplete translations
  • Required message category validation

Dynamic Locale Detection in CDK

  • Automatic locale detection based on Lex bot export structure
  • Dynamic generation of bot locale configurations
  • Eliminates hardcoded locale lists in CDK stack
  • Reads confidence thresholds from BotLocale.json files

馃敡 Improvements

Simplified Lambda Function Structure

  • Reduced Lambda function boilerplate by ~50% through automatic handling
  • Eliminated manual MessageManager initialization calls
  • Removed manual exception handling try/catch blocks
  • Streamlined configuration through enhanced Config class

Enhanced Deployment Scripts

  • Improved deployment script with better error handling
  • Automatic cleanup of old wheel files to prevent hash conflicts
  • Targeted uv cache cleaning for specific packages
  • Lock file regeneration to avoid dependency conflicts

Enhanced Testing

  • Added pytest to pre-commit hooks for continuous testing
  • Comprehensive test coverage for all new features
  • Message consistency validation across locales

馃摝 Technical Details

  • Enhanced Config class with new optional parameters
  • Improved error response creation with proper Lex formatting
  • Dynamic locale detection using filesystem scanning
  • All existing functionality preserved while improving developer experience