src/Leevel/Database/Connect.php
protected function pdoException(PDOException $e): void
    {
        $message = $e->getMessage();

        // 模拟数据库 replace
        if ('23000' === $e->getCode() &&
            false !== strpos($message, 'Duplicate entry')) {
            throw new ReplaceException($message);
        }

        throw $e;
    }
protected function pdoException(PDOException $e): void
    {
        $message = $e->getMessage();

        // 模拟数据库 replace
        if ('23000' === $e->getCode() &&
            false !== strpos($message, 'Duplicate entry')) {
            throw new ReplaceException($message);
        }

        throw $e;
    }
PDO 异常处理.

@param \PDOException $e