hphp/hack/manual/apis/Classes/HH/AsyncGenerator/raise.md
:::info[Note] This is a point-in-time snapshot of the API documentation from January 2026. Going forward, we will not be maintaining a public copy of these references, and recommend users to refer to the built-in signature helpers available in the Hack LSP instead for complete and up-to-date information. :::
Raise an exception to the async generator
public function raise(
Exception $exception,
): Awaitable<?(Tk, Tv)>;
You should always await the returned Awaitable to get the actual
key/value tuple.
If null is returned, that means you have reached the end of iteration.
You cannot call raise() without having the value returned from a previous
call to raise(), next(), send(), having first awaited.
Exception $exceptionAwaitable<?(Tk,Tv)> - The Awaitable that produced the yielded key/value tuple after
the exception is processed. What is returned is a tuple or
null.