mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-21 16:24:46 +00:00
fix(cli): improve terminal error guidance
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { normalizeOptionalString } from "../../shared/string-coerce.js";
|
||||
import { formatCliCommand } from "../command-format.js";
|
||||
import { formatInvalidConfigPort, formatInvalidPortOption } from "../error-format.js";
|
||||
import { buildDaemonServiceSnapshot, installDaemonServiceAndEmit } from "./response.js";
|
||||
import {
|
||||
createDaemonInstallActionContext,
|
||||
@@ -94,12 +95,12 @@ export async function runDaemonInstall(opts: DaemonInstallOptions) {
|
||||
const cfg = configSnapshot.valid ? configSnapshot.sourceConfig : configSnapshot.config;
|
||||
const portOverride = parsePort(opts.port);
|
||||
if (opts.port !== undefined && portOverride === null) {
|
||||
fail("Invalid --port. Use a port number from 1 to 65535, for example 18789.");
|
||||
fail(formatInvalidPortOption("--port"));
|
||||
return;
|
||||
}
|
||||
const port = portOverride ?? resolveGatewayPort(cfg);
|
||||
if (!Number.isFinite(port) || port <= 0 || port > 65_535) {
|
||||
fail("Invalid Gateway port in config. Set gateway.port to a number from 1 to 65535.");
|
||||
fail(formatInvalidConfigPort("gateway.port"));
|
||||
return;
|
||||
}
|
||||
const runtimeRaw = opts.runtime ? opts.runtime : DEFAULT_GATEWAY_DAEMON_RUNTIME;
|
||||
|
||||
Reference in New Issue
Block a user