Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
21e8 committed Dec 7, 2024
1 parent 951defd commit d69b641
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/batcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>).catch((error) => {
console.error(`Processor failed:`, error);
});
}
Expand Down
5 changes: 3 additions & 2 deletions src/processors/telegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
clearErrorTracking,
formatClassifiedError,
} from '../utils/errorClassifier';
// import fetch from 'node-fetch';

const EMOJIS: Record<NotificationLevel, string> = {
error: '🚨',
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d69b641

Please sign in to comment.