mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 20:51:10 +00:00
refactor: dedupe core error formatting call sites
This commit is contained in:
@@ -36,7 +36,6 @@ import { withProgress } from "../progress.js";
|
||||
import { ensureDevGatewayConfig } from "./dev.js";
|
||||
import { runGatewayLoop } from "./run-loop.js";
|
||||
import {
|
||||
describeUnknownError,
|
||||
extractGatewayMiskeys,
|
||||
maybeExplainGatewayServiceStop,
|
||||
parsePort,
|
||||
@@ -559,7 +558,7 @@ async function runGatewayCommand(opts: GatewayRunOpts) {
|
||||
}
|
||||
} catch (err) {
|
||||
if (isGatewayLockError(err)) {
|
||||
const errMessage = describeUnknownError(err);
|
||||
const errMessage = formatErrorMessage(err);
|
||||
defaultRuntime.error(
|
||||
`Gateway failed to start: ${errMessage}\nIf the gateway is supervised, stop it with: ${formatCliCommand("openclaw gateway stop")}`,
|
||||
);
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
resolveGatewayWindowsTaskName,
|
||||
} from "../../daemon/constants.js";
|
||||
import { resolveGatewayService } from "../../daemon/service.js";
|
||||
import { formatErrorMessage } from "../../infra/errors.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { formatCliCommand } from "../command-format.js";
|
||||
import { parsePort } from "../shared/parse-port.js";
|
||||
@@ -21,10 +20,6 @@ export const toOptionString = (value: unknown): string | undefined => {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export function describeUnknownError(err: unknown): string {
|
||||
return formatErrorMessage(err);
|
||||
}
|
||||
|
||||
export function extractGatewayMiskeys(parsed: unknown): {
|
||||
hasGatewayToken: boolean;
|
||||
hasRemoteToken: boolean;
|
||||
|
||||
Reference in New Issue
Block a user