final class DatabaseException extends RuntimeException (View source)

Represents invalid database configuration or use that prevents a driver operation from proceeding.

Methods

connectionFailed(string $message, Throwable|null $previous = null)

Creates an exception for a failed physical connection while retaining the driver error as its cause.

queryFailed(string $sql, string $message, Throwable|null $previous = null)

Creates an exception that preserves both failed SQL and the original driver failure.

unsupportedDriver(string $driver)

Creates an exception for a driver lacking a registered framework implementation.

invalidConfiguration(string $message)

Creates an exception for configuration that cannot form a usable database service.

Details

connectionFailed

static DatabaseException connectionFailed(string $message, Throwable|null $previous = null)

Creates an exception for a failed physical connection while retaining the driver error as its cause.

Parameters

string $message
Throwable|null $previous

Return Value

DatabaseException

queryFailed

static DatabaseException queryFailed(string $sql, string $message, Throwable|null $previous = null)

Creates an exception that preserves both failed SQL and the original driver failure.

Parameters

string $sql
string $message
Throwable|null $previous

Return Value

DatabaseException

unsupportedDriver

static DatabaseException unsupportedDriver(string $driver)

Creates an exception for a driver lacking a registered framework implementation.

Parameters

string $driver

Return Value

DatabaseException

invalidConfiguration

static DatabaseException invalidConfiguration(string $message)

Creates an exception for configuration that cannot form a usable database service.

Parameters

string $message

Return Value

DatabaseException