Implemented structured exception handling: Exception Hierarchy: - BridgeError (base) ├── ConfigurationError │ └── ConfigValidationError ├── ConnectionError │ ├── MQTTConnectionError │ └── OdooAPIError (with status_code, response fields) ├── DeviceError │ ├── DeviceNotFoundError │ └── ParserError (with topic, payload context) └── ValidationError Changes: - Created exceptions.py with comprehensive exception classes - Updated clients/odoo_client.py to use OdooAPIError * Replaced generic Exception with OdooAPIError * Added status_code and response context * Better error messages for API failures - Updated clients/mqtt_client.py to import MQTTConnectionError - Updated config/loader.py to use ConfigurationError * Replaced FileNotFoundError with ConfigurationError * Added file path context to errors - Updated parsers/shelly_parser.py to import ParserError (for future use) Benefits: - Specific exception types enable targeted error handling - Better debugging with structured error context - Easier to catch and handle specific error categories - Backward compatible - errors still propagate correctly - Foundation for better error reporting in Phase 4 Remaining Phase 2 tasks (deferred): - 2.2: main.py refactoring (will be separate PR) - 2.3: Config management modernization (Pydantic migration) See OPTIMIZATION_PLAN.md Phase 2.1 for details. |
||
|---|---|---|
| .github/workflows | ||
| extra-addons/open_workshop/open_workshop_mqtt | ||
| iot_bridge | ||
| odoo@fd43f0445a | ||
| .gitignore | ||
| .readthedocs.yaml | ||
| DEPLOYMENT.md | ||
| DOCUMENTATION_STRATEGY.md | ||
| FEATURE_REQUEST_DEVICE_STATUS.md | ||
| FEATURE_REQUEST_OPEN_WORKSHOP_MQTT_IoT.md | ||
| IMPLEMENTATION_PLAN_DEVICE_STATUS.md | ||
| IMPLEMENTATION_PLAN.md | ||