class ZtdPdoException
    extends PDOException
Public API: explicitly declared with @visibility public.

ZTD-specific exception that extends PDOException.

This allows users to catch either PDOException or ZtdPdoException for ZTD-specific errors while maintaining compatibility with existing PDO exception handling code.

Catch ZTD failures as PDO exceptionsdoctest
$error = new \ZtdQuery\Adapter\Pdo\ZtdPdoException('Cannot simulate this statement');
    $error instanceof \PDOException // => true

Methods§

public function __construct(string $message, int $code = 0, ?Throwable $previous = null)
Public API: explicitly declared with @visibility public.

Binds the instance to what it will work from.

Parameters

$messagestring
$codeint
$previous?Throwable
Preserve the original database failuredoctest
$cause = new \RuntimeException('Database failure');
    $error = new \ZtdQuery\Adapter\Pdo\ZtdPdoException('Simulation failed', 7, $cause);
    $error->getMessage() // => 'Simulation failed'
    $error->getCode() // => 7
    $error->getPrevious() === $cause // => true
Calls 1
  • static-call PDOException::__construct() line 39

Test cases 16§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5
Other tests reaching this symbol 11

Relations§

Instantiated in 4