refactor(inspector): compose provider close failures through the shared owner

V8InspectorProvider built its multi-failure cleanup composite by hand and
bound the parts with bindCleanupDependencies. providerCleanupErrorFromFailures
builds the same composite: resources, reason, operation, aggregate cause
and release tracking.

Refs #11859

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
gensokyo-devandgensokyo-dev authored and Ysopwnable committed 2026-11-21 19:34:01 +01:00
1 parent 13725d2986
commit a5f3689179
2 files changed
+8 -12

No files matched your search

@@ -15,7 +15,6 @@
"src/hopper/HopperAnalysisProfile.ts": 1,
"src/hopper/HopperImageCopy.ts": 1,
"src/ida/IdaSessionClient.ts": 1,
"src/inspector/V8InspectorProvider.ts": 1,
"src/javascript/sourceMaps/SourceMapCommand.ts": 4,
"src/jeb/JebMcpConnectionOwner.ts": 1,
"src/jeb/JebProvider.ts": 1,
+8 -11
View File
@@ -25,8 +25,10 @@ import {
} from "../domain/analysisErrorCore.js";
import { BrowserObservationError } from "../domain/browserObservationError.js";
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
import { analysisErrorWithCleanupFailure } from "../domain/analysisErrorCleanup.js";
import {
analysisErrorWithCleanupFailure,
providerCleanupErrorFromFailures,
} from "../domain/analysisErrorCleanup.js";
import type { BrowserObservationOperation } from "../domain/browserObservationErrors.js";
import { err, ok, type Result } from "../domain/result.js";
import { delayWithCancellation } from "../browser/CdpCaptureValues.js";
@@ -132,20 +134,15 @@ export class V8InspectorAdmission {
}
if (failures.length === 0) return;
if (failures.length === 1) throw failures[0]!;
const cleanup = new ProviderCleanupError(
throw providerCleanupErrorFromFailures(
V8_INSPECTOR_PROVIDER_IDENTITY.id,
failures.flatMap(({ cleanupResources }) => cleanupResources),
{ reason: "Inspector provider cleanup remains incomplete." },
failures,
"Inspector provider cleanup remains incomplete.",
{
operation: "observe_javascript_runtime",
cause: new AggregateError(
failures,
"Inspector provider cleanup owners remain unresolved.",
),
message: "Inspector provider cleanup owners remain unresolved.",
},
);
cleanup.bindCleanupDependencies(failures);
throw cleanup;
} finally {
this.#closing = false;
}