From 578d8730bce10b16eaa10bdf1c782cc661ae83f1 Mon Sep 17 00:00:00 2001 From: armaan Date: Tue, 23 Jun 2026 20:53:29 +0000 Subject: [PATCH] fix: replace non-null assertion with throwErr pattern in mapWithConcurrency Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- packages/shared/src/utils/promises.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/utils/promises.tsx b/packages/shared/src/utils/promises.tsx index 9c6be9f10..2c69fb5d2 100644 --- a/packages/shared/src/utils/promises.tsx +++ b/packages/shared/src/utils/promises.tsx @@ -1,6 +1,6 @@ import { KnownError } from ".."; import { getProcessEnv } from "./env"; -import { HexclaveAssertionError, captureError, concatStacktraces, errorToNiceString } from "./errors"; +import { HexclaveAssertionError, captureError, concatStacktraces, errorToNiceString, throwErr } from "./errors"; import { DependenciesMap } from "./maps"; import { Result } from "./results"; import { traceSpan } from "./telemetry"; @@ -461,7 +461,7 @@ export async function mapWithConcurrency( const index = nextIndex++; if (index >= items.length) return; try { - results[index] = await fn(items[index]!, index); + results[index] = await fn(items[index] ?? throwErr(`mapWithConcurrency: index ${index} out of bounds for items of length ${items.length}`), index); } catch (error) { aborted = true; throw error;