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

namespace Doctrine\DBAL\Driver\OCI8;

5 6
use Doctrine\DBAL\Driver\AbstractDriverException;

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

23
        return new self($error['message'], null, $error['code']);
24 25
    }
}