classDatabaseException
class DatabaseException
extends RuntimeException
Database exception that wraps driver-specific errors.
This exception provides a unified interface for handling database errors from different drivers (PDO, mysqli, SQLite3).
Methods§
public function __construct(
string $message,
int|null $driverErrorCode = null,
int $code = 0,
Throwable|null $previous = null,
)Parameters
$message | string | Exception message. |
$driverErrorCode | int|null | Driver-specific error code. |
$code | int | Exception code. |
$previous | Throwable|null | Previous exception. |
Test cases 4
Calls 1
- static-call
RuntimeException::__construct()line 35
public function getDriverErrorCode(): ?intGet the driver-specific error code.
Returns
?intTest cases 5
FakeErrorClassifier::isUnknownSchemaErrorcallsDatabaseExceptionTest::testCarriesEverythingADriverSaidAboutTheFailurecovers and callsDatabaseExceptionTest::testCarriesNothingTheDriverDidNotSaycovers and callsDatabaseExceptionTest::testGetDriverErrorCodeReturnsCodecovers and callsDatabaseExceptionTest::testGetDriverErrorCodeReturnsNullcovers and calls
Private surface 1§
Implementation details, listed for orientation only.
private ?int $driverErrorCodeTest cases 13§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
DatabaseExceptionTest::testCarriesEverythingADriverSaidAboutTheFailurecovers and callsDatabaseExceptionTest::testCarriesNothingTheDriverDidNotSaycovers and callsDatabaseExceptionTest::testGetDriverErrorCodeReturnsCodecovers and callsDatabaseExceptionTest::testGetDriverErrorCodeReturnsNullcovers and calls
Other tests reaching this symbol 9
FakeErrorClassifier::isUnknownSchemaErrorcallsErrorClassifierTest::testIsUnknownSchemaErrorAnswersForAFailureThePlatformCallsOnecallsErrorClassifierTest::testIsUnknownSchemaErrorIsFalseForAFailureAboutSomethingElsecallsErrorClassifierTest::testIsUnknownSchemaErrorIsFalseForAFailureTheDriverPutNoCodeOncallsRewriteRefusalTest::testForUnknownSchemaRaisesWhereTheCallerAskedToBeToldcallsRewriteRefusalTest::testForUnsupportedRaisesWhereTheCallerAskedToBeToldcallsSessionTestcallsShadowApplicationTestcallsStatementSimulatorTest::testUnsupportedSqlThrowscalls