lib/SqlException.php
<?php declare(strict_types=1);
/**
* ___ _ _
* | _ \__ _| |_ __ _| |__ __ _ ___ ___
* | _/ _` | _/ _` | '_ \/ _` (_-</ -_)
* |_| \__,_|\__\__,_|_.__/\__,_/__/\___|
*
* This file is part of Kristuff\Patabase.
* (c) Kristuff <kristuff@kristuff.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @version 1.0.1
* @copyright 2017-2022 Christophe Buliard
*/
namespace Kristuff\Patabase;
/**
* Class SqlException
*/
class SqlException extends \Exception
{
/**
* Initializes the exception with givn parent exception
*
* Converts the error code to int in case driver returns it as string.
*
* @access public
* @param string $message
* @param int $code
* @param \Exception $previous
*/
public function __construct(string $message, int $code = 0, ?\Exception $previous = null)
{
// some drivers may return $code as string => force int
parent::__construct($message, intval($code), $previous);
}
}