| 1 |
<?php |
| 2 |
|
| 3 |
class WP_SQLite_Driver_Exception extends PDOException { |
| 4 |
/** |
| 5 |
* The SQLite driver that originated the exception. |
| 6 |
* |
| 7 |
* @var WP_SQLite_Driver |
| 8 |
*/ |
| 9 |
private $driver; |
| 10 |
|
| 11 |
/** |
| 12 |
* Constructor. |
| 13 |
* |
| 14 |
* @param WP_SQLite_Driver $driver The SQLite driver that originated the exception. |
| 15 |
* @param string $message The exception message. |
| 16 |
* @param int|string $code The exception code. In PDO, it can be a string with value of SQLSTATE. |
| 17 |
* @param Throwable|null $previous The previous throwable used for the exception chaining. |
| 18 |
*/ |
| 19 |
public function __construct( |
| 20 |
WP_SQLite_Driver $driver, |
| 21 |
string $message, |
| 22 |
$code = 0, |
| 23 |
?Throwable $previous = null |
| 24 |
) { |
| 25 |
parent::__construct( $message, 0, $previous ); |
| 26 |
$this->code = $code; |
| 27 |
$this->driver = $driver; |
| 28 |
} |
| 29 |
|
| 30 |
public function getDriver(): WP_SQLite_Driver { |
| 31 |
return $this->driver; |
| 32 |
} |
| 33 |
} |
| 34 |
|