refactor: centralize target errors and cache lookups

This commit is contained in:
Peter Steinberger
2026-01-17 04:28:19 +00:00
parent 3efc5e54fa
commit 5fcc9b3244
20 changed files with 185 additions and 68 deletions

View File

@@ -3,6 +3,7 @@ import type { ChannelOutboundAdapter } from "../../../src/channels/plugins/types
import { createMSTeamsPollStoreFs } from "./polls.js";
import { sendMessageMSTeams, sendPollMSTeams } from "./send.js";
import { missingTargetError } from "../../../src/infra/outbound/target-errors.js";
export const msteamsOutbound: ChannelOutboundAdapter = {
deliveryMode: "direct",
@@ -14,9 +15,7 @@ export const msteamsOutbound: ChannelOutboundAdapter = {
if (!trimmed) {
return {
ok: false,
error: new Error(
"Delivering to MS Teams requires target <conversationId|user:ID|conversation:ID>",
),
error: missingTargetError("MS Teams", "<conversationId|user:ID|conversation:ID>"),
};
}
return { ok: true, to: trimmed };