Skip to content

Commit 9acccf7

Browse files
committed
Throw exception if download media fail
1 parent e6ec706 commit 9acccf7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,6 +3505,8 @@ export class BaileysStartupService extends ChannelStartupService {
35053505
this.logger.error('Download Media failed, trying to retry in 5 seconds...');
35063506
await new Promise((resolve) => setTimeout(resolve, 5000));
35073507
const mediaType = Object.keys(msg.message).find((key) => key.endsWith('Message'));
3508+
if (!mediaType) throw new Error('Could not determine mediaType for fallback');
3509+
35083510
try {
35093511
const media = await downloadContentFromMessage(
35103512
{
@@ -3523,6 +3525,7 @@ export class BaileysStartupService extends ChannelStartupService {
35233525
this.logger.info('Download Media with downloadContentFromMessage was successful!');
35243526
} catch (fallbackErr) {
35253527
this.logger.error('Download Media with downloadContentFromMessage also failed!');
3528+
throw fallbackErr;
35263529
}
35273530
}
35283531
const typeMessage = getContentType(msg.message);

0 commit comments

Comments
 (0)