Skip to content

Commit 4a5696e

Browse files
Merge pull request #1704 from rafwell/develop
Throw exception if download media fail
2 parents 1152048 + f11d490 commit 4a5696e

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
@@ -3521,6 +3521,8 @@ export class BaileysStartupService extends ChannelStartupService {
35213521
this.logger.error('Download Media failed, trying to retry in 5 seconds...');
35223522
await new Promise((resolve) => setTimeout(resolve, 5000));
35233523
const mediaType = Object.keys(msg.message).find((key) => key.endsWith('Message'));
3524+
if (!mediaType) throw new Error('Could not determine mediaType for fallback');
3525+
35243526
try {
35253527
const media = await downloadContentFromMessage(
35263528
{
@@ -3539,6 +3541,7 @@ export class BaileysStartupService extends ChannelStartupService {
35393541
this.logger.info('Download Media with downloadContentFromMessage was successful!');
35403542
} catch (fallbackErr) {
35413543
this.logger.error('Download Media with downloadContentFromMessage also failed!');
3544+
throw fallbackErr;
35423545
}
35433546
}
35443547
const typeMessage = getContentType(msg.message);

0 commit comments

Comments
 (0)