Fill the exception by an array. The following keys are supported:
sqlstate, code, msg

@param array $error

@return self
165517
public function fill(array $error)
    {
        $this->setSqlState(isset($error['sqlstate']) ? $error['sqlstate'] : 'HY000')
             ->setNativeCode(isset($error['code']) ? $error['code'] : 0)
             ->setNativeMessage(isset($error['msg']) ? $error['msg'] : '');

        return $this;

    }
65087
public function setError($key, $error)
    {
        if (isset($key)) {
            gplcart_array_set($this->errors, $key, $error);
            return $this->errors;
        }

        return $this->errors = (array) $error;
    }
1091360
protected function modelValidationError(array $error)
    {
        $code = ('no_permission' == $error['error']) ? 403 : 400;
        $param = array_value($error, 'params.field');

        return new InvalidRequest($error['message'], $code, $param);
    }
985183
public function setError($error, $propertyName)
    {
        $this->errors[$this->propertyName][$propertyName] = $error;

        return $this;
    }
23721
public static function handleFatalError(array $error = null)
    {
        if (null === self::$reservedMemory) {
            return;
        }

        self::$reservedMemory = null;

        $handler = set_error_handler('var_dump');
        $handler = is_array($handler) ? $handler[0] : null;
        restore_error_handler();

        if (!$handler instanceof self) {
            return;
        }

        if ($exit = null === $error) {
            $error = error_get_last();
        }

        try {
            while (self::$stackedErrorLevels) {
                static::unstackErrors();
            }
        } catch (\Exception $exception) {
            // Handled below
        } catch (\Throwable $exception) {
            // Handled below
        }

        if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
            // Let's not throw anymore but keep logging
            $handler->throwAt(0, true);
            $trace = isset($error['backtrace']) ? $error['backtrace'] : null;

            if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
                $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
            } else {
                $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
            }
        }

        try {
            if (isset($exception)) {
                self::$exitCode = 255;
                $handler->handleException($exception, $error);
            }
        } catch (FatalErrorException $e) {
            // Ignore this re-throw
        }

        if ($exit && self::$exitCode) {
            $exitCode = self::$exitCode;
            register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
        }
    }
648685
public function int($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::INT, 'message' => $error]);
        }

        return $this;
    }
901663
public function countMax($countMax, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::COUNTMAX, 'value' => $countMax, 'message' => $error]);
        }

        return $this;
    }
293889
protected function _addException(Exception $exception)
    {
        $this->_hasErrors = true;
        $this->_errorsList[$exception->getCode()] = [
            'message'   => $exception->getMessage(),
            'line'      => $exception->getLine(),
            'file'      => $exception->getFile(),
            'trace'     => $exception->getTraceAsString(),
        ];

        return $this;
    }
1295560
public function addError($error) {
        // Make sure that we don't try to index an error that doesn't
        // contain an index value.
        if ($error->getErrorCode() == null) {
            require_once 'Zend/Gdata/App/Exception.php';
            throw new Zend_Gdata_App_Exception("Error encountered without corresponding error code.");
        }

        $this->_errors[$error->getErrorCode()] = $error;
    }
758290
protected function FillInstance($errorId, $errorMessage, $exception) {
        $this->errorId = $errorId;
        $this->errorMessage = $errorMessage;
        $this->exceptionObj = $exception;
    }
116698
public function errors($errors)
    {
        $this->success = false;
        $this->data['errors'] = $errors instanceof MessageBag
            ? $errors->toArray()
            : $errors;

        return $this;
    }
673532
public function createException(NativeError $error, Exception $original=null)
    {
        switch ($error->code) {
            case self::PERM:
            case self::READONLY:
            case self::AUTH:
            case self::CANTOPEN:
                return new SQLDeniedException($error->message, $error, 0, $original);
//             case self::ABORT: Cannot reproduce this
                // Canceled
//                 echo "\nABORT ERROR $error->code";
//                 break;
            case self::BUSY:
            case self::LOCKED:
            case self::PROTOCOL:
            case self::ROW:
                return new SQLLockException($error->message, $error, 0, $original);
            case self::IOERR:
            case self::CORRUPT:
            case self::NO_DB:
                return new SQLIOException($error->message, $error, 0, $original);
            case self::NOMEM:
            case self::FULL:
            case self::TOOBIG:
                // Cannot reproduce this in ci
                // @codeCoverageIgnoreStart
                return new SQLExceededException($error->message, $error, 0, $original);
                // @codeCoverageIgnoreEnd
            case self::CONSTRAINT:
            case self::MISMATCH:
            case self::MISUSE:
                return new SQLConstraintException($error->message, $error, 0, $original);

        }

        return $this->exceptionByMessage($error, $original);
    }
1008051
public function ip($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::IP, 'message' => $error]);
        }

        return $this;
    }
896029
protected function addError($message, $code = null)
    {
        $this->adapter->add($message, $code, 'error');
        return $this;
    }
343032
public function notExist($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::NOTEXIST, 'message' => $error]);
        }

        return $this;
    }
1322443
public function handleException($exception, array $error = null)
    {
        if (null === $error) {
            self::$exitCode = 255;
        }
        if (!$exception instanceof \Exception) {
            $exception = new FatalThrowableError($exception);
        }
        $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
        $handlerException = null;

        if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
            if (false !== strpos($message = $exception->getMessage(), "class@anonymous\0")) {
                $message = (new FlattenException())->setMessage($message)->getMessage();
            }
            if ($exception instanceof FatalErrorException) {
                if ($exception instanceof FatalThrowableError) {
                    $error = [
                        'type' => $type,
                        'message' => $message,
                        'file' => $exception->getFile(),
                        'line' => $exception->getLine(),
                    ];
                } else {
                    $message = 'Fatal '.$message;
                }
            } elseif ($exception instanceof \ErrorException) {
                $message = 'Uncaught '.$message;
            } else {
                $message = 'Uncaught Exception: '.$message;
            }
        }
        if ($this->loggedErrors & $type) {
            try {
                $this->loggers[$type][0]->log($this->loggers[$type][1], $message, ['exception' => $exception]);
            } catch (\Throwable $handlerException) {
            }
        }
        if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
            foreach ($this->getFatalErrorHandlers() as $handler) {
                if ($e = $handler->handleError($error, $exception)) {
                    $exception = $e;
                    break;
                }
            }
        }
        $exceptionHandler = $this->exceptionHandler;
        $this->exceptionHandler = null;
        try {
            if (null !== $exceptionHandler) {
                return $exceptionHandler($exception);
            }
            $handlerException = $handlerException ?: $exception;
        } catch (\Throwable $handlerException) {
        }
        if ($exception === $handlerException) {
            self::$reservedMemory = null; // Disable the fatal error handler
            throw $exception; // Give back $exception to the native handler
        }
        $this->handleException($handlerException);
    }
593428
public function exception($exception = null)
    {
        if (!func_num_args()) {
            return $this->_exception;
        }
        $this->_exception = $exception;
        return $this;
    }