Skip to content

Instantly share code, notes, and snippets.

@gmorel
Last active October 26, 2016 14:27
Show Gist options
  • Save gmorel/7ccdcaaff0c61215f553497e4140246e to your computer and use it in GitHub Desktop.
Save gmorel/7ccdcaaff0c61215f553497e4140246e to your computer and use it in GitHub Desktop.
    public function run(Operation $operation, $isMain = true)
    {
        if ($this->waitStrategy instanceof StatefulWaiter && true === $isMain) {
            $this->waitStrategy->resetState();
        }
        try {
            return $this->runner->run($operation);
        } catch (\Throwable $e) {
            // treated below
        } catch (\Exception $e) {
            // treated below
        }
        // @todo keep only inner if once ExceptionCatcher is gone
        if ($this->exceptionCatcherVoter instanceof ThrowableCatcherVoter) {
            if (!$this->exceptionCatcherVoter->shouldCatchThrowable($e)) {
                throw $e;
            }
        } elseif (!$this->exceptionCatcherVoter->shouldCatch($e)) {
            throw $e;
        }
        try {
            $this->waitStrategy->wait();
        } catch (WaiterException $waiterException) {
            throw $e;
        }
        return $this->run($operation, false);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment