{@inheritdoc}
@throws Exception
192245
public function indexesByAlias(string $alias): array
    {
        $response = $this->searchClient->request('GET', '/_alias/' . $alias);
        $statusCode = $response->getStatusCode();
        if ($statusCode !== 200 && $statusCode !== 404) {
            throw new Exception('The alias "' . $alias . '" was not found with some unexpected error... (return code: ' . $statusCode . ')', 1383650137);
        }

        // return empty array if content from response cannot be read as an array
        $treatedContent = $response->getTreatedContent();

        return is_array($treatedContent) ? array_keys($treatedContent) : [];
    }
538737
public function invoke($node, NodeInterface $parent): void
    {
        if ($this->config->hasInterfaceParsing()) {
            if (! $node instanceof Node\Stmt\Interface_ || ! $parent instanceof PhpFileModelInterface) {
                throw new Exception('InterfaceNodeParser is made to parse an interface node');
            }

            $interface = new InterfaceModel();
            $interface->setParentNode($parent);
            $interface->setName(ClassLikeNameHelper::getName($node));
            $parent->addConcreteUse($parent->getFullNameFor($interface->getName()), $interface->getName());

            if (($documentation = $node->getDocComment()) !== null) {
                $this->documentationNodeParser->invoke($documentation, $interface);
            }

            $this->parseSubNodes($node->stmts, $interface);

            $parent->addInterface($interface);
        }
    }
421872
public void init() throws Exception {
        userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
        System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());

        if (!cfg.exists()) {

            ConfigurationManager manager = new ConfigurationManager(cfg, false, locateConfigurationProvider());

            try {

                manager.runProjectConfigurationInitializers();

                if (options.isVerbose()) {
                    log.info("CONFIGURATION FILE [" + cfg.getAbsolutePath() + "] CREATION COMPLETE");
                }

            } catch (IOException aux) {
                if (options.isVerbose()) {
                    log.error("The system can't create the file [ " + cfg.getAbsolutePath() + "]");
                }
                if (options.isThrowException()) {
                    System.setProperty("user.dir", userDir);
                    throw aux;
                }
            }

        } else {
            if (options.isVerbose()) {
                log.error("The configuration file [" + cfg.getAbsolutePath() + "] already exists");
            }
        }
        System.setProperty("user.dir", userDir);
    }
256566
public function handle()
    {
        $package = $this->argument('package');
        $command = $this->argument('commandname');
        if (Package::where('name', $package)->count() > 0) {
            throw new Exception("Package with name ($package) already exist");
        }
        if (Package::where('command', $command)->count() > 0) {
            throw new Exception("Package with command ($command) already exist");
        }
        Package::create([
            'name' => $package,
            'namespace' => $this->argument('namespace'),
            'command' => $command,
        ]);
    }
166348
@Override
  protected void run() throws Exception {
    final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath());
    final Map<String, Object> context = createContext();
    final Map<String, Object> options = Maps.newHashMap();
    final ConsoleWindow console = getRuntime().createConsoleWindow();

    WindowHandle handle = console.open(getRuntimeRealm(), resourceLoader, context, options);
    handle.await();
  }
871656
public function process($value)
        {

            if ($this->isMandatory() && !$value)
            {
                throw new Exception($this->getMessage(self::IS_MISSING, ['param', $this->reference]));
            }

            $dataProcessor = $this->getDataProcessor();

            if ($dataProcessor instanceof ApplicationAwareInterface)
            {
                $dataProcessor->setApplication($this->getApplication());
            }

            $processedValue = $dataProcessor->process($value);

            if($this->isMandatory() && is_null($processedValue))
            {
                throw new Exception($this->getMessage(self::IS_MISSING, ['param', $this->reference]));
            }

            return $processedValue;
        }
1157785
public function generate()
    {
        if (!$this->iKnowWhatIAmDoing) {
            throw new \Exception('You don\'t know what you\'re doing!');
        }

        $this->cleanUp();

        $schema = $this->getSchema();

        echo "Interfaces generation...\r\n";
        $this->generateInterfaces();

        echo "Class generation...\r\n";
        $this->generateClasses($schema);

        if ($this->backwardCompatibility) {
            $this->php7ClassNames = false;
            $this->generateClasses($schema);
            $this->php7ClassNames = true;
        }
    }
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;
    }
362274
private function exception() : void
    {
        if ($this->response->getStatusCode() === Response::HTTP_FORBIDDEN) {
            throw ServiceException::invalidApiKey();
        }

        if ($this->response->getStatusCode() === Response::HTTP_UNPROCESSABLE_ENTITY) {
            throw ServiceException::invalidPayload();
        }

        if ($this->response->getStatusCode() === Response::HTTP_TOO_MANY_REQUESTS) {
            throw ServiceException::rateLimit();
        }

        if ($this->response->getStatusCode() === Response::HTTP_INTERNAL_SERVER_ERROR) {
            throw ServiceException::serverError();
        }

        throw ServiceException::generic();
    }
324736
public function commit()
    {
        if ($this->_active && $this->_db->getActive()) {
            $this->_db->getPdoInstance()->commit();
            $this->_active = false;
        } else {
            throw new Exception('"Transaction"尚属未激活状态，不能执行"commit"和"rollback"操作', 101300601);
        }
    }
299896
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Param || ! $parent instanceof FunctionModelInterface) {
            throw new Exception('ParameterNodeParser is made to parse a function parameter node');
        }

        $parameter = new ParameterModel();
        $parameter->setParentNode($parent);
        $parameter->setName($node->var->name);
        $parameter->setIsVariadic($node->variadic);

        if ($node->type !== null) {
            $this->typeNodeParser->invoke($node->type, $parameter);
        }
        if ($node->default !== null) {
            $this->valueNodeParser->invoke($node->default, $parameter);
        }

        $parent->addParameter($parameter);
    }
333289
@Override
  public final synchronized void init() throws Exception {
    FactoryBldServices<ResultSet> factoryBldServices =
      new FactoryBldServices<ResultSet>();
    factoryBldServices.setFactoryAppBeans(this);
    setFactoryBldServices(factoryBldServices);
    FactoryReplicatorXmlHttps<ResultSet> factoryReplicatorXmlHttps =
      new FactoryReplicatorXmlHttps<ResultSet>();
    factoryReplicatorXmlHttps.setFactoryAppBeans(this);
    setFactoryReplicatorXmlHttps(factoryReplicatorXmlHttps);
    FactoryDatabaseWriterXml<ResultSet> factoryDatabaseWriterXml =
      new FactoryDatabaseWriterXml<ResultSet>();
    factoryDatabaseWriterXml.setFactoryAppBeans(this);
    setFactoryDatabaseWriterXml(factoryDatabaseWriterXml);
  }
275337
public function sendException(\Exception $exception)
  {
    $this->setStatusCode($exception->getCode(), $exception->getMessage());

    $this->setJsonContent($this);

    return parent::send();
  }
1119314
public function collect(Request $request, Response $response, \Exception $exception = null)
    {
        $parameters = array();
        $services = array();

        $this->loadContainerBuilder();

        if ($this->containerBuilder !== false) {
            foreach ($this->containerBuilder->getParameterBag()->all() as $key => $value) {
                $service = substr($key, 0, strpos($key, '.'));
                if (!isset($parameters[$service])) {
                    $parameters[$service] = array();
                }
                $parameters[$service][$key] = $value;
            }

            $serviceIds = $this->containerBuilder->getServiceIds();
            foreach ($serviceIds as $serviceId) {
                $definition = $this->resolveServiceDefinition($serviceId);

                if ($definition instanceof Definition && $definition->isPublic()) {
                    $services[$serviceId] = array('class' => $definition->getClass());
                } elseif ($definition instanceof Alias) {
                    $services[$serviceId] = array('alias' => $definition);
                } else {
                    continue;    // We don't want private services
                }
            }

            ksort($services);
            ksort($parameters);
        }
        $this->data['parameters'] = $parameters;
        $this->data['services'] = $services;
    }
1307008
public void start()
        throws Exception
    {
        _unavailable=0;
        super.start();
        
        if (!javax.servlet.Servlet.class
            .isAssignableFrom(_class))
        {
            Exception ex = new IllegalStateException("Servlet "+_class+
                                            " is not a javax.servlet.Servlet");
            super.stop();
            throw ex;
        }        

        _config=new Config();
        if (_runAs!=null)
            _realm=_httpHandler.getHttpContext().getRealm();

        if (javax.servlet.SingleThreadModel.class
            .isAssignableFrom(_class))
            _servlets=new Stack();

        if (_initOnStartup)
        {
            _servlet=(Servlet)newInstance();
            try
            {
                initServlet(_servlet,_config);
            }
            catch(Throwable e)
            {
                _servlet=null;
                _config=null;
                if (e instanceof Exception)
                    throw (Exception) e;
                else if (e instanceof Error)
                    throw (Error)e;
                else
                    throw new ServletException(e);
            }            
        }  
    }
864023
@Override
    protected void doExecute() throws Exception {
        final AnnotationHandler annotationHandler = getAnnotationHandler();

        final Set<Method> methods = findAnnotatedMethods(annotationHandler);

        final Map<String, FunctionConfiguration> configMap = getFunctionConfigurations(annotationHandler, methods);

        validateFunctionConfigurations(configMap);

        final ObjectWriter objectWriter = getObjectWriter();

        writeEmptyHostJsonFile(objectWriter);

        writeFunctionJsonFiles(objectWriter, configMap);

        copyJarsToStageDirectory();

        final CommandHandler commandHandler = new CommandHandlerImpl(this.getLog());
        final FunctionCoreToolsHandler functionCoreToolsHandler = getFunctionCoreToolsHandler(commandHandler);
        final Set<BindingEnum> bindingClasses = this.getFunctionBindingEnums(configMap);

        installExtension(functionCoreToolsHandler, bindingClasses);

        info(BUILD_SUCCESS);
    }
522504
public function flush()
    {
        if (!$this->getClient()->flush()) {
            throw new \Exception($this->getClient()->getResultMessage(), $this->getClient()->getResultCode());
        }
    }