in src/ExpectObj.hack [656:679]
private function tryCallReturnException<Tclass as \Throwable>(
classname<Tclass> $expected_exception_type,
): ?Tclass where T as (function(): mixed) {
try {
$callable = $this->var;
$returned = $callable();
if ($returned is Awaitable<_>) {
/* HHAST_IGNORE_ERROR[DontUseAsioJoin] */
\HH\Asio\join($returned);
}
} catch (\Exception $e) {
$e = expect($e)->toBeInstanceOf(
$expected_exception_type,
'Expected to throw "%s", but instead got <%s> with message "%s"',
$expected_exception_type,
\get_class($e),
$e->getMessage(),
);
return $e;
}
return null;
}