mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
fix(source-maps): preserve decoder lifecycle facts (#10069)
* fix(source-maps): preserve decoder lifecycle facts * fix(source-maps): preserve preparation failure on cancellation * fix(source-maps): retain preparation and retry cleanup facts
This commit is contained in:
1 parent
d36ba58971
commit
8a2eb4ab61
4 files changed
+368
-32
No files matched your search
@@ -6,8 +6,10 @@ import {
|
||||
import type { ExecutionOptions } from "../../application/AnalysisProvider.js";
|
||||
import type { WebSourceMapPort } from "../../application/WebSourceLocationPorts.js";
|
||||
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
|
||||
import { analysisErrorWithCancellation } from "../../domain/analysisErrorCancellation.js";
|
||||
import {
|
||||
AnalysisCancelledError,
|
||||
AnalysisCapabilityUnavailableError,
|
||||
AnalysisInputError,
|
||||
} from "../../domain/analysisErrorCore.js";
|
||||
import { ArtifactOperationError } from "../../domain/artifactOperationError.js";
|
||||
@@ -23,7 +25,6 @@ import {
|
||||
type SourceMapCleanupRetention,
|
||||
type SourceMapDecoderDependencies,
|
||||
} from "./SourceMapCommand.js";
|
||||
import { ProviderCleanupError } from "../../domain/providerCleanupError.js";
|
||||
import { jsonParts } from "../../domain/jsonSerialization.js";
|
||||
const OPERATION = "trace_web_source_location";
|
||||
|
||||
@@ -43,22 +44,20 @@ export class SourceMapDecoder implements WebSourceMapPort {
|
||||
if (this.#closing)
|
||||
return Promise.resolve(
|
||||
err(
|
||||
new ProviderCleanupError(
|
||||
new AnalysisCapabilityUnavailableError(
|
||||
"source-map-decoder",
|
||||
[],
|
||||
{ reason: "Provider is closing" },
|
||||
{ operation: OPERATION },
|
||||
OPERATION,
|
||||
"Provider is closing",
|
||||
),
|
||||
),
|
||||
);
|
||||
const operation = this.#tail.then(() =>
|
||||
this.#closing
|
||||
? err(
|
||||
new ProviderCleanupError(
|
||||
new AnalysisCapabilityUnavailableError(
|
||||
"source-map-decoder",
|
||||
[],
|
||||
{ reason: "Provider is closing" },
|
||||
{ operation: OPERATION },
|
||||
OPERATION,
|
||||
"Provider is closing",
|
||||
),
|
||||
)
|
||||
: this.#trace(input, options),
|
||||
@@ -75,7 +74,17 @@ export class SourceMapDecoder implements WebSourceMapPort {
|
||||
options?: ExecutionOptions,
|
||||
): Promise<Result<WebSourceMapReport, AnalysisError>> {
|
||||
const cleanupFailure = await this.#retryCleanup();
|
||||
if (cleanupFailure !== undefined) return err(cleanupFailure);
|
||||
if (cleanupFailure !== undefined)
|
||||
return err(
|
||||
options?.signal?.aborted
|
||||
? analysisErrorWithCancellation(
|
||||
cleanupFailure,
|
||||
new AnalysisCancelledError(OPERATION, {
|
||||
cause: options.signal.reason,
|
||||
}),
|
||||
)
|
||||
: cleanupFailure,
|
||||
);
|
||||
if (options?.signal?.aborted)
|
||||
return err(
|
||||
new AnalysisCancelledError(OPERATION, { cause: options.signal.reason }),
|
||||
|
||||
Reference in new issue
Block a user