- Introduced a new `exceptions.py` file containing custom exceptions for the exchanges module, improving error specificity and handling. - Updated the `factory.py` and `registry.py` files to utilize the new exceptions, enhancing robustness in error reporting and logging. - Implemented validation logic in `ExchangeCollectorConfig` to ensure proper configuration, raising appropriate exceptions when validation fails. - Enhanced logging throughout the factory methods to provide better insights into the collector creation process and error scenarios. - Added comprehensive documentation for the exchanges module, detailing the architecture, error handling, and usage examples. These changes significantly improve the error handling and maintainability of the exchanges module, aligning with project standards and enhancing developer experience.
30 lines
902 B
Python
30 lines
902 B
Python
"""
|
|
Custom exceptions for the exchanges module.
|
|
|
|
This module contains all custom exceptions used in the exchanges package
|
|
to provide more specific error handling and better error messages.
|
|
"""
|
|
|
|
class ExchangeError(Exception):
|
|
"""Base exception for all exchange-related errors."""
|
|
pass
|
|
|
|
class ExchangeNotSupportedError(ExchangeError):
|
|
"""Raised when an exchange is not supported or not found in registry."""
|
|
pass
|
|
|
|
class InvalidConfigurationError(ExchangeError):
|
|
"""Raised when exchange configuration is invalid."""
|
|
pass
|
|
|
|
class CollectorCreationError(ExchangeError):
|
|
"""Raised when there's an error creating a collector instance."""
|
|
pass
|
|
|
|
class ExchangeConnectionError(ExchangeError):
|
|
"""Raised when there's an error connecting to an exchange."""
|
|
pass
|
|
|
|
class ValidationError(ExchangeError):
|
|
"""Raised when validation fails for exchange parameters."""
|
|
pass |