mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 23:12:52 +00:00
fix(cli): compact gateway command failures
This commit is contained in:
@@ -71,6 +71,7 @@ export function formatGatewayCommandFailure(params: {
|
||||
const raw = params.error instanceof Error ? params.error.message : String(params.error);
|
||||
const message = raw
|
||||
.replace(/\s*Run [`"]?openclaw doctor[`"]? for diagnostics\.?/gi, "")
|
||||
.replace(/\s+Gateway target:\s+.*$/isu, "")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim()
|
||||
.replace(/[.。]+$/u, "");
|
||||
|
||||
@@ -177,7 +177,9 @@ describe("secrets CLI", () => {
|
||||
|
||||
it("explains Gateway reload failures without duplicate doctor noise", async () => {
|
||||
callGatewayFromCli.mockRejectedValue(
|
||||
new Error("gateway closed (1006 abnormal closure). Run `openclaw doctor` for diagnostics."),
|
||||
new Error(
|
||||
"gateway closed (1006 abnormal closure). Gateway target: ws://127.0.0.1:18789 Source: local loopback Config: /tmp/openclaw.json Bind: loopback Possible causes: - Gateway not yet ready. Run `openclaw doctor` for diagnostics.",
|
||||
),
|
||||
);
|
||||
|
||||
await expect(
|
||||
@@ -188,6 +190,7 @@ describe("secrets CLI", () => {
|
||||
"Could not reload secrets because the Gateway did not respond: gateway closed (1006 abnormal closure).",
|
||||
);
|
||||
expect(runtimeErrors.at(-1)).toContain("openclaw gateway status --deep");
|
||||
expect(runtimeErrors.at(-1)).not.toContain("Gateway target:");
|
||||
expect(runtimeErrors.at(-1)).not.toContain("diagnostics..");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user