@throws Exception

@return $this
498484
protected function findClassDefinition()
    {
        foreach ($this->classes as $class) {
            if ($class->name == $this->classShortName) {
                $this->classAbstractTree = $class;

                return $this;
            }
        }

        throw new Exception('Class '.$this->classShortName.' not found');
    }
941129
public function execute() {
        if(is_null($this->client)) {
            $this->client = $this->getConnection();
        }
        if(is_null($this->query)) {
            throw new Exception('No query');
        }

        list($query_data, $meta) = $this->constructQuery($this->source, $this->query, $this->aggs, $this->post_query, $this->settings);

        $results_set = $this->query($query_data, $meta);
        $results = $this->processResults($results_set, $meta);
        $results = $this->postProcessResults($this->post_query, $results, $meta);

        return $results;
    }
293569
public function register()
    {
        if (!$this->registered) {
            error_reporting($this->errorLevel);
            set_exception_handler([$this, 'handleException']);
            set_error_handler([$this, 'handleError'], $this->errorLevel);
            register_shutdown_function([$this, 'handleShutdown']);

            $this->registered = true;
        }

        return $this;
    }
133045
public function save()
    {
        $str = $this->prepareForSave($this->toArray());
        if (empty($this->__path)) {
            throw new Exception('Empty path for config save');
        }
        file_put_contents($this->__path, '<?php' . PHP_EOL . PHP_EOL . 'return ' . $str . ';');
        return $this;
    }
913483
public function setConfig()
    {
        $this->config = (require static::prependPackagePath('bootstrap/config.php'))['web-drivers'];

        $this->config = @$this->config[$this->getDriver()][$this->getUserOS()];

        if (!$this->config) {
            throw new \ErrorException("Currently {$this->getDriver()} not supported.");
        }

        return $this;
    }
430490
public function load()
  {
    $m = $this->getManager();
    if (!$pk = $this->getPrimaryKey()) {
      Exception::ThrowError(Exception::PK_NOT_SET, __CLASS__);
    }

    $q = $m->getQueryBuilder()
      ->select($this->getTable())
      ->where(array($pk => $this->get($pk)));

    $this->vars = $m->query($q)->fetch(\PDO::FETCH_ASSOC);

    return $this;
  }
210972
public function limit($limit)
    {
        if (intval($limit) != $limit) {
            throw new \Exception('The limit must be an integer');
        }

        $this->limit = (int) $limit;

        return $this;
    }
578316
public function run()
    {
        $this->init();
        try {
            $this->bootstrap();
            $this->route();
            $this->dispatch();
        } catch (Exception $e) {
            if (APPLICATION_ENV == self::ENV_DEV) {
                var_dump($e);
            } else {
                throw $e;
            }
        }
        return $this;
    }
385059
public function send()
    {
        if ($this->message === null) {
            throw new Exception(
                'No message set. You have to set one with Message::setMessage()'
                . ' or use Notification::sendMessage(title, msg) instead.'
            );
        }

        $this->notify($this->title, $this->message, realpath($this->icon));

        return $this;
    }
817260
public function check()
    {
        try {
            try {
                $this->result(
                    $this->resource->checker->setTarget($this)->checkTarget(
                        $this
                    )
                );
            } catch (\Exception $exception) {
                report($exception);

                $this->exceptionResult($exception);
            }
        } catch (\Throwable $error) {
            report($error);

            $this->exceptionResult($error);
        }

        $this->moveChecksBackToTarget();

        return $this;
    }
730355
public function setMethod($method)
    {
        $method = strtolower($method);

        if (in_array($method, [Form::METHOD_GET, Form::METHOD_POST])) {
            $this->method = $method;
        } else {
            throw new \Exception('Incorrect method value given');
        }
        return $this;
    }
1050924
public function execute()
    {
        $stmt = $this->dbh->prepare($this->__toString());

        try {
            $success = $stmt->execute($this->getValues());
            if (!$success) {
                $info = $stmt->errorInfo();

                throw new Exception($info[2], $info[0]);
            }
        } catch (PDOException $e) {
            throw new Exception($e->getMessage(), $e->getCode(), $e);
        }

        return $stmt;
    }
1297361
public function validate()
    {
        if ($this->_validationDone) {
            throw new Exception('Validation was already done - call clearErrors() to reset');
        }

        foreach ($this->_definition as $key => $def) {
            if (is_int($key)) {
                throw new Exception ('Form field names can not be numeric - there probably is a typo in the form definition');
            }

            $value = $this->$key;

            $this->getValidator()->validateField($key, $def, $value);
        }

        $this->_validationDone = true;

        return $this;
    }
267048
public function addException(\Exception $e)
    {
        if ($this->initialized && $this->enabled()) {
            $this->debugbar['exceptions']->addException($e);
        }

        return $this;
    }
789434
public function create()
	{
		try
		{
			$this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources')
				->withQuery(http_build_query([
					'path' => $this->getPath()
				], null, '&')), 'PUT'));
			$this->setContents([]);
		}
		catch (\Exception $exc)
		{
			throw $exc;
		}

		return $this;
	}
209466
public function setException(exception $e)
    {
        if (isset($this->response)) {
            $this->response->setException($e);
        } else {
            throw $e;
        }
    }
495208
public function one()
    {
        if ($this->exception !== null) {
            throw $this->exception;
        }

        return $this->fetch(false, $this->fetchAssoc);
    }