mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:38:25 +00:00
refactor(gateway): share node invoke error handling
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
||||
import { handleNodeInvokeResult } from "./nodes.handlers.invoke-result.js";
|
||||
import {
|
||||
respondInvalidParams,
|
||||
respondUnavailableOnNodeInvokeError,
|
||||
respondUnavailableOnThrow,
|
||||
safeParseJson,
|
||||
uniqueSortedStrings,
|
||||
@@ -433,14 +434,7 @@ export const nodeHandlers: GatewayRequestHandlers = {
|
||||
timeoutMs: p.timeoutMs,
|
||||
idempotencyKey: p.idempotencyKey,
|
||||
});
|
||||
if (!res.ok) {
|
||||
respond(
|
||||
false,
|
||||
undefined,
|
||||
errorShape(ErrorCodes.UNAVAILABLE, res.error?.message ?? "node invoke failed", {
|
||||
details: { nodeError: res.error ?? null },
|
||||
}),
|
||||
);
|
||||
if (!respondUnavailableOnNodeInvokeError(respond, res)) {
|
||||
return;
|
||||
}
|
||||
const payload = res.payloadJSON ? safeParseJson(res.payloadJSON) : res.payload;
|
||||
|
||||
Reference in New Issue
Block a user