mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 03:00:25 +00:00
refactor: dedupe channel runtime error formatting
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { createDraftStreamLoop } from "openclaw/plugin-sdk/channel-lifecycle";
|
||||
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
||||
import { deleteSlackMessage, editSlackMessage } from "./actions.js";
|
||||
import { SLACK_TEXT_LIMIT } from "./limits.js";
|
||||
import { sendMessageSlack } from "./send.js";
|
||||
@@ -80,9 +81,7 @@ export function createSlackDraftStream(params: {
|
||||
params.onMessageSent?.();
|
||||
} catch (err) {
|
||||
stopped = true;
|
||||
params.warn?.(
|
||||
`slack stream preview failed: ${err instanceof Error ? err.message : String(err)}`,
|
||||
);
|
||||
params.warn?.(`slack stream preview failed: ${formatErrorMessage(err)}`);
|
||||
}
|
||||
};
|
||||
const loop = createDraftStreamLoop({
|
||||
@@ -113,9 +112,7 @@ export function createSlackDraftStream(params: {
|
||||
accountId: params.accountId,
|
||||
});
|
||||
} catch (err) {
|
||||
params.warn?.(
|
||||
`slack stream preview cleanup failed: ${err instanceof Error ? err.message : String(err)}`,
|
||||
);
|
||||
params.warn?.(`slack stream preview cleanup failed: ${formatErrorMessage(err)}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { WebClient } from "@slack/web-api";
|
||||
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
||||
import { isRecord } from "openclaw/plugin-sdk/text-runtime";
|
||||
import { createSlackWebClient } from "./client.js";
|
||||
|
||||
@@ -84,7 +85,7 @@ async function callSlack(
|
||||
} catch (err) {
|
||||
return {
|
||||
ok: false,
|
||||
error: err instanceof Error ? err.message : String(err),
|
||||
error: formatErrorMessage(err),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user