diff --git a/src/batcher.ts b/src/batcher.ts index 49458a1..f53cea6 100644 --- a/src/batcher.ts +++ b/src/batcher.ts @@ -100,10 +100,11 @@ export function createMessageBatcher( for (const item of batch) { for (const processor of processors) { try { - // Handle both sync and async calls - const result = processor.processBatch([item]); - if (result && typeof result.then === 'function') { - result.catch((error) => { + if (processor.processBatchSync) { + processor.processBatchSync([item]); + } else { + // Handle async processBatch by ignoring the Promise + (processor.processBatch([item]) as Promise).catch((error) => { console.error(`Processor failed:`, error); }); } diff --git a/src/processors/telegram.ts b/src/processors/telegram.ts index 3a54c06..49f0f17 100644 --- a/src/processors/telegram.ts +++ b/src/processors/telegram.ts @@ -9,7 +9,6 @@ import { clearErrorTracking, formatClassifiedError, } from '../utils/errorClassifier'; -// import fetch from 'node-fetch'; const EMOJIS: Record = { error: '🚨', @@ -76,7 +75,9 @@ export function createTelegramProcessor( console.error('[Telegram] API Response:', data); const errorData = data as TelegramApiError; throw new Error( - `Telegram API error: ${response.statusText || 'Unknown Error'} - ${errorData.description || JSON.stringify(data)}` + `Telegram API error: ${response.statusText || 'Unknown Error'} - ${ + errorData.description || JSON.stringify(data) + }` ); } } catch (error) {