refactor: normalize cli command hints
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { extractErrorCode, formatErrorMessage } from "../infra/errors.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { resolveBrowserConfig } from "./config.js";
|
||||
|
||||
let cachedConfigToken: string | null | undefined = undefined;
|
||||
@@ -30,8 +31,7 @@ function enhanceBrowserFetchError(url: string, err: unknown, timeoutMs: number):
|
||||
const cause = unwrapCause(err);
|
||||
const code = extractErrorCode(cause) ?? extractErrorCode(err) ?? "";
|
||||
|
||||
const hint =
|
||||
"Start (or restart) the Clawdbot gateway (Clawdbot.app menubar, or `clawdbot gateway`) and try again.";
|
||||
const hint = `Start (or restart) the Clawdbot gateway (Clawdbot.app menubar, or \`${formatCliCommand("clawdbot gateway")}\`) and try again.`;
|
||||
|
||||
if (code === "ECONNREFUSED") {
|
||||
return new Error(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { ensurePageState, getPageForTargetId } from "./pw-session.js";
|
||||
import { normalizeTimeoutMs } from "./pw-tools-core.shared.js";
|
||||
|
||||
@@ -65,7 +66,7 @@ export async function responseBodyViaPlaywright(opts: {
|
||||
cleanup();
|
||||
reject(
|
||||
new Error(
|
||||
`Response not found for url pattern "${pattern}". Run 'clawdbot browser requests' to inspect recent network activity.`,
|
||||
`Response not found for url pattern "${pattern}". Run '${formatCliCommand("clawdbot browser requests")}' to inspect recent network activity.`,
|
||||
),
|
||||
);
|
||||
}, timeout);
|
||||
|
||||
Reference in New Issue
Block a user