fix: replace non-null assertion with throwErr pattern in mapWithConcurrency

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
armaan 2026-06-23 20:53:29 +00:00
parent 9e4ac14153
commit 578d8730bc

View File

@ -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<T, R>(
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;