diff --git a/bun.lock b/bun.lock index a6e3b80..2ca713d 100644 --- a/bun.lock +++ b/bun.lock @@ -388,7 +388,7 @@ }, "packages/slack": { "name": "@blink-sdk/slack", - "version": "1.2.1", + "version": "1.2.2", "devDependencies": { "@ai-sdk/provider": "^2.0.0", "@slack/types": "^2.17.0", diff --git a/packages/slack/package.json b/packages/slack/package.json index c2372d3..0c0ad09 100644 --- a/packages/slack/package.json +++ b/packages/slack/package.json @@ -1,6 +1,6 @@ { "name": "@blink-sdk/slack", - "version": "1.2.1", + "version": "1.2.2", "author": { "name": "Coder", "email": "support@blink.so", diff --git a/packages/slack/src/message.ts b/packages/slack/src/message.ts index 543be83..973f525 100644 --- a/packages/slack/src/message.ts +++ b/packages/slack/src/message.ts @@ -582,7 +582,12 @@ export const extractMessagesMetadata = async < for (const channelId of channelIds) { channelPromises[channelId] = client.conversations .info({ channel: channelId }) - .then((res) => res.channel); + .then((res) => { + if (!res.ok) { + throw new Error(`Failed to get channel info: ${res.error}`); + } + return res.channel; + }); } // Fetch team info @@ -591,9 +596,12 @@ export const extractMessagesMetadata = async < Promise > = {}; for (const teamId of teamIds) { - teamPromises[teamId] = client.team - .info({ team: teamId }) - .then((res) => res.team); + teamPromises[teamId] = client.team.info({ team: teamId }).then((res) => { + if (!res.ok) { + throw new Error(`Failed to get team info: ${res.error}`); + } + return res.team; + }); } // Fetch user info @@ -602,9 +610,12 @@ export const extractMessagesMetadata = async < Promise > = {}; for (const userId of userIds) { - userPromises[userId] = client.users - .info({ user: userId }) - .then((res) => res.user); + userPromises[userId] = client.users.info({ user: userId }).then((res) => { + if (!res.ok) { + throw new Error(`Failed to get user info: ${res.error}`); + } + return res.user; + }); } // Fetch files