import { firstValueFrom, Observable } from "rxjs"; export async function firstValueFromOrThrow( value: Observable, name: string, ): Promise { const result = await firstValueFrom(value); if (result == null) { throw new Error(`Failed to get ${name}`); } return result; }