| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- from __future__ import annotations
- class MySQLBaseException(Exception):
- """Base exception for this mysql helper library."""
- def __init__(
- self,
- message: str,
- error_code: str | None = None,
- original_error: Exception | None = None,
- ):
- super().__init__(message)
- self.message = message
- self.error_code = error_code
- self.original_error = original_error
- class MySQLConnectionError(MySQLBaseException):
- """Raised when connecting to MySQL fails."""
- class MySQLConfigError(MySQLBaseException):
- """Raised when configuration is invalid."""
- class MySQLQueryError(MySQLBaseException):
- """Raised when executing a SQL statement fails."""
- class MySQLTransactionError(MySQLBaseException):
- """Raised when a transaction fails."""
- class MySQLPoolError(MySQLBaseException):
- """Raised when connection pool fails."""
- class MySQLValidationError(MySQLBaseException):
- """Raised when input data validation fails."""
|