Create an ErrorException from an Error.

@param \Error $e

@return ErrorException
358903
public static function fromError(\Error $e)
    {
        return new self($e->getMessage(), $e->getCode(), 1, $e->getFile(), $e->getLine(), $e);
    }
875600
protected function convertDatabaseException(\Exception $e)
	{
		if($e instanceof DatabaseException)
		{
			return $e;
		}
		
		// Check for PDO exception in order to determine FK violation:
		$cause = $e;
		
		if(!$cause instanceof \PDOException)
		{
			while(NULL !== ($cause = $cause->getPrevious()))
			{
				if($cause instanceof \PDOException)
				{
					break;
				}
			}
		}
		
		if($cause instanceof \PDOException)
		{
			switch($this->driverName)
			{
				case DB::DRIVER_MYSQL:
					return $this->convertMySqlException($cause, $e);
				case DB::DRIVER_POSTGRESQL:
					return $this->convertPostgresException($cause, $e);
				case DB::DRIVER_SQLITE:
					return $this->convertSqliteException($cause, $e);
			}
		}
		
		return new DatabaseException($e->getMessage(), 0, $e);
	}
25028
protected function returnException(Exception $e)
    {
        $key = snake_case(class_basename($e));
        $message = $this->translate($key, $e->getMessage());

        return new ExceptionReply($message, [], $e);
    }
992992
protected function handleGenericException(Exception $e)
    {
        // Get the status code and build the message.
        $statusCode = 500;
        $message = $e->getMessage();

        return $this->generateResponse('', null, $statusCode, Status::FAIL, $message);
    }
90212
public function handleException($e)
    {
        if (!isset($this->route)) {
            return false;
        }
        return $this->route->handleException($e);
    }
819987
protected function formatException(\Exception $e)
	{
		if ($this->debug)
		{
			$location = $e->getMessage().' in '.$e->getFile().':'.$e->getLine();

			return 'Error in exception handler: '.$location;
		}

		return 'Error in exception handler.';
	}
484253
private function convertToMountebankException(ClientException $e)
    {
        return $this->exceptionFactory->createInstanceFromMountebankResponse(
            (string)$e->getResponse()->getBody()
        );
    }
39666
protected function handleErrorException(\ErrorException $exception)
    {
        switch ($exception->getSeverity()) {
            case E_ERROR:
            case E_RECOVERABLE_ERROR:
            case E_CORE_ERROR:
            case E_COMPILE_ERROR:
            case E_USER_ERROR:
            case E_PARSE:
                $this->logger->error($this->buildLogMessage($exception));
                break;

            case E_WARNING:
            case E_USER_WARNING:
            case E_CORE_WARNING:
            case E_COMPILE_WARNING:
                $this->logger->warning($this->buildLogMessage($exception));
                break;

            case E_NOTICE:
            case E_USER_NOTICE:
                $this->logger->notice($this->buildLogMessage($exception));
                break;

            case E_STRICT:
            case E_DEPRECATED:
            case E_USER_DEPRECATED:
                $this->logger->info($this->buildLogMessage($exception));
                break;
        }

        return true;
    }
63597
public static function wrap(RequestException $e)
    {
        $response = $e->getResponse();

        if ($errors = self::errors($response)) {
            $class = self::exceptionClass($response, $errors[0]);
            $message = implode(', ', array_map('strval', $errors));
        } else {
            $class = self::exceptionClass($response);
            $message = $e->getMessage();
        }

        return new $class($message, $errors, $e->getRequest(), $response, $e);
    }
1332700
public function handleError(\Error $e): Response
    {
        $this->logger->error(sprintf('%s in %s:%d', $e->getMessage(), $e->getFile(), $e->getLine()));
        return $this->providePhpErrorResponse($e);
    }
1039640
public function exception(\Exception $e, array $options = [])
    {
        $message = $this->createExceptionMessages($e);
        return $this->message($message);
    }
604314
public static function raiseError(\Exception $e)
	{
		if(self::$debug)
			self::$debugData .= "Exception at " . basename($e->getFile()) . ":"
				. $e->getLine() . ": " . self::makePrintable($e->getMessage())
				. "\n";
	}
246097
public function handleException($ex)
    {
        if ($ex instanceof \Exception || $ex instanceof \Throwable) {
            throw new \ErrorException($ex->getMessage(), $ex->getCode(), E_ALL, $ex->getFile(), $ex->getLine());
        }
    }
339723
public static function getFormattedExceptionMessage(\Exception $e)
    {
        $name = static::getExceptionNameHierarchy($e);

        list($file, $line, $stackTrace) = static::getOriginalExceptionFileAndLineNumber($e);

        $message = "{$name}: {$e->getMessage()} ({$e->getcode()})\n{$file} {$line}\n{$stackTrace}";

        return $message;
    }
1118336
public static function createFromException($e, $level, array $context = [])
    {
        return new static($e->getMessage(), $level, $context, $e->getCode(), $e->getPrevious());
    }
1170323
public function feedPDOException(\PDOException $e) {
		$this->errorInfo = $e->errorInfo;
		$this->message = $e->getMessage();
		$this->code = $e->getCode();
		$this->file = $e->getFile();
		$this->line = $e->getLine();
		return $this;
	}
1285459
private function _exceptionHandler($e)
    {
        $this->_errorController->setParams(array('e' => $e));
        $action = FrontController::EXCEPTION_HANDLER_ACTION . 'Action';
        $this->_response->setStatusCode(500);

        return $this->_errorController->$action();
    }