OCI8Exception.php 548 Bytes
Newer Older
1 2 3 4
<?php

namespace Doctrine\DBAL\Driver\OCI8;

5 6 7
use Doctrine\DBAL\Driver\AbstractDriverException;

class OCI8Exception extends AbstractDriverException
8
{
Benjamin Morel's avatar
Benjamin Morel committed
9
    /**
Sergei Morozov's avatar
Sergei Morozov committed
10
     * @param mixed[]|false $error
Benjamin Morel's avatar
Benjamin Morel committed
11 12 13
     *
     * @return \Doctrine\DBAL\Driver\OCI8\OCI8Exception
     */
14
    public static function fromErrorInfo($error)
15
    {
Sergei Morozov's avatar
Sergei Morozov committed
16 17 18 19
        if ($error === false) {
            return new self('Database error occurred but no error information was retrieved from the driver.');
        }

20
        return new self($error['message'], null, $error['code']);
21 22
    }
}