fix: prevent double-wrapping of WebPortInspectionError and remove unused extraWebPortCount
- In WebPortInspector, the mapError handler now checks if the error is already a WebPortInspectionError (via _tag) and passes it through, preserving the original 'HTTP probe timed out' detail instead of re-wrapping it with 'Failed to execute HTTP probe request'. - Remove unused extraWebPortCount field from TerminalRuntimeStatus interface and its computation in terminalRuntimeStatus().
This commit is contained in:
2 files changed
+16
-12
No files matched your search
@@ -127,15 +127,22 @@ const makeWebPortInspector = Effect.gen(function* () {
|
||||
onSome: Effect.succeed,
|
||||
}),
|
||||
),
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new WebPortInspectionError({
|
||||
port,
|
||||
host,
|
||||
detail: "Failed to execute HTTP probe request.",
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
Effect.mapError((cause) => {
|
||||
if (
|
||||
typeof cause === "object" &&
|
||||
cause !== null &&
|
||||
"_tag" in cause &&
|
||||
cause._tag === "WebPortInspectionError"
|
||||
) {
|
||||
return cause as WebPortInspectionError;
|
||||
}
|
||||
return new WebPortInspectionError({
|
||||
port,
|
||||
host,
|
||||
detail: "Failed to execute HTTP probe request.",
|
||||
cause,
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ export function selectPendingTerminalEventEntries(
|
||||
interface TerminalRuntimeStatus {
|
||||
label: string;
|
||||
primaryWebPort: number | null;
|
||||
extraWebPortCount: number;
|
||||
}
|
||||
|
||||
function normalizeRunningPorts(rawPorts: number[] | undefined): number[] {
|
||||
@@ -99,7 +98,6 @@ function terminalRuntimeStatus(
|
||||
|
||||
const runningPorts = normalizeRunningPorts(runningTerminalPorts[terminalId]);
|
||||
const primaryWebPort = runningPorts[0] ?? null;
|
||||
const extraWebPortCount = runningPorts.length > 1 ? runningPorts.length - 1 : 0;
|
||||
const label =
|
||||
runningPorts.length === 0
|
||||
? "Terminal process running"
|
||||
@@ -110,7 +108,6 @@ function terminalRuntimeStatus(
|
||||
return {
|
||||
label,
|
||||
primaryWebPort,
|
||||
extraWebPortCount,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user