throw example



/** * @internal */
#[Package('command')] class TestCommand extends Command
{
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $testCause = new TestCause();
        $testCause->throw(new TestException('test'));

        return Command::SUCCESS;
    }
}

/** * @internal */
#[Package('command')] class TestNestedCommand extends Command
{
    
$this->result->reject($throwable);
        }
    }

    /** * @internal */
    public function _handleFailure($reason): void
    {
        unset($this->currentPromise);
        try {
            $nextYield = $this->generator->throw(Create::exceptionFor($reason));
            // The throw was caught, so keep iterating on the coroutine             $this->nextCoroutine($nextYield);
        } catch (Throwable $throwable) {
            $this->result->reject($throwable);
        }
    }
}
Home | Imprint | This part of the site doesn't use cookies.