mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 04:30:22 +00:00
refactor: dedupe core helper error formatting
This commit is contained in:
@@ -27,6 +27,7 @@ import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { resolveStateDir } from "../../../config/paths.js";
|
||||
import { formatErrorMessage } from "../../../infra/errors.js";
|
||||
import { createSubsystemLogger } from "../../../logging/subsystem.js";
|
||||
import type { HookHandler } from "../../hooks.js";
|
||||
|
||||
@@ -60,7 +61,7 @@ const logCommand: HookHandler = async (event) => {
|
||||
|
||||
await fs.appendFile(logFile, logLine, "utf-8");
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
const message = formatErrorMessage(err);
|
||||
log.error(`Failed to log command: ${message}`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user