8. Exceptions

Custom exceptions for wpostgresql.

exception wpostgresql.exceptions.WPostgreSQLError[source]

Bases: Exception

Base exception for wpostgresql errors.

exception wpostgresql.exceptions.ConnectionError[source]

Bases: WPostgreSQLError

Exception raised for connection errors.

exception wpostgresql.exceptions.TableSyncError[source]

Bases: WPostgreSQLError

Exception raised during table synchronization.

exception wpostgresql.exceptions.ValidationError[source]

Bases: WPostgreSQLError

Exception raised for validation errors.

exception wpostgresql.exceptions.OperationError[source]

Bases: WPostgreSQLError

Exception raised for database operation errors.

exception wpostgresql.exceptions.SQLInjectionError[source]

Bases: WPostgreSQLError

Exception raised when SQL injection is detected.

exception wpostgresql.exceptions.TransactionError[source]

Bases: WPostgreSQLError

Exception raised for transaction errors.

8.1. Exception Hierarchy

  • wpostgresql.WPostgreSQLError
    • wpostgresql.ConnectionError

    • wpostgresql.TableSyncError

    • wpostgresql.ValidationError

    • wpostgresql.OperationError

    • wpostgresql.SQLInjectionError

    • wpostgresql.TransactionError

8.2. Usage Example

from wpostgresql import WPostgreSQL, ConnectionError

try:
    db = WPostgreSQL(User, db_config)
except ConnectionError as e:
    print(f"Failed to connect: {e}")