mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 12:41:12 +00:00
refactor: dedupe runtime error formatting
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { formatErrorMessage } from "../infra/errors.js";
|
||||
import { runCommandWithTimeout } from "../process/exec.js";
|
||||
|
||||
export type PluginCommandRunResult = {
|
||||
@@ -40,7 +41,7 @@ export async function runPluginCommandWithTimeout(
|
||||
return {
|
||||
code: 1,
|
||||
stdout: "",
|
||||
stderr: error instanceof Error ? error.message : String(error),
|
||||
stderr: formatErrorMessage(error),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import { formatErrorMessage } from "../infra/errors.js";
|
||||
import {
|
||||
installRequestBodyLimitGuard,
|
||||
isRequestBodyLimitError,
|
||||
@@ -268,8 +269,7 @@ export async function readWebhookBodyOrReject(params: {
|
||||
return respondWebhookBodyReadError({
|
||||
res: params.res,
|
||||
code: "INVALID_BODY",
|
||||
invalidMessage:
|
||||
params.invalidBodyMessage ?? (error instanceof Error ? error.message : String(error)),
|
||||
invalidMessage: params.invalidBodyMessage ?? formatErrorMessage(error),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user