Files
reverse-engineering-anything/src/application/SetupCancellation.ts
T
morluto 2826592759 refactor(application): build application cancellations with a required reason (#10574)
* refactor(application): build application cancellations with a required reason

Migrate every AnalysisCancelledError construction under src/application
to cancelledBy and lower the guard baseline from 671 to 442.

Shutdown refusals in BinarySession report OwnerCancellation.ownerClosed
when the caller did not abort, instead of an undefined reason.
ReverseEngineeringService and DesktopBuildOwnedWork close their work
with the typed owner reason. SharedStartupAttempt returns the departing
caller's reason with a cancelled wait. One shared isAborted predicate
replaces eleven local copies and narrows a checked signal for
cancelledBy.

* refactor(desktop): drop an unused cancellation import from desktop capture state
2026-11-15 18:38:24 +08:00

15 lines
403 B
TypeScript

import { cancelledBy } from "../domain/analysisErrorCore.js";
/** Preserve the caller's exact reason while setup unwinds its resource owners. */
export const assertSetupActive = (
signal?: AbortSignal,
failure?: string,
): void => {
if (signal?.aborted)
throw cancelledBy(
"setup",
signal,
failure === undefined ? {} : { diagnostics: { setup_failure: failure } },
);
};