refactor: dedupe extension string helpers

This commit is contained in:
Peter Steinberger
2026-04-07 04:28:32 +01:00
parent d03985415d
commit d9fbfa268f
8 changed files with 17 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
import type { WebClient } from "@slack/web-api";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import { isRecord } from "openclaw/plugin-sdk/text-runtime";
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
import { createSlackWebClient } from "./client.js";
export type SlackScopesResult = {
@@ -71,8 +71,7 @@ function readError(payload: unknown): string | undefined {
if (!isRecord(payload)) {
return undefined;
}
const error = payload.error;
return typeof error === "string" && error.trim() ? error.trim() : undefined;
return normalizeOptionalString(payload.error);
}
async function callSlack(