mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 00:31:22 +00:00
fix(daemon): surface probe close reasons (#56282)
Merged via squash.
Prepared head SHA: c356980aa4
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
import { withProgress } from "../progress.js";
|
||||
|
||||
function resolveProbeFailureMessage(result: {
|
||||
error?: string | null;
|
||||
close?: { code: number; reason: string } | null;
|
||||
}): string {
|
||||
const closeHint = result.close
|
||||
? `gateway closed (${result.close.code}): ${result.close.reason}`
|
||||
: null;
|
||||
if (closeHint && (!result.error || result.error === "timeout")) {
|
||||
return closeHint;
|
||||
}
|
||||
return result.error ?? closeHint ?? "gateway probe failed";
|
||||
}
|
||||
|
||||
export async function probeGatewayStatus(opts: {
|
||||
url: string;
|
||||
token?: string;
|
||||
@@ -47,12 +60,9 @@ export async function probeGatewayStatus(opts: {
|
||||
if (result.ok) {
|
||||
return { ok: true } as const;
|
||||
}
|
||||
const closeHint = result.close
|
||||
? `gateway closed (${result.close.code}): ${result.close.reason}`
|
||||
: null;
|
||||
return {
|
||||
ok: false,
|
||||
error: result.error ?? closeHint ?? "gateway probe failed",
|
||||
error: resolveProbeFailureMessage(result),
|
||||
} as const;
|
||||
} catch (err) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user