Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

466 B
Raw Blame
/** Attempt every owned cleanup and retain the primary verification failure. */
export async function closeVerifierResources(tasks, primaryError) {
  const failures = [];
  for (const task of tasks) {
    try {
      await task();
    } catch (cause) {
      failures.push(cause);
    }
  }

  if (failures.length > 0)
    throw new AggregateError(
      primaryError === undefined ? failures : [primaryError, ...failures],
      "Verifier cleanup failed",
    );
}