Merge pull request #1704 from rafwell/develop

Throw exception if download media fail
This commit is contained in:
Davidson Gomes 2025-07-14 14:44:29 -03:00 committed by GitHub
commit 4a5696eda9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3521,6 +3521,8 @@ export class BaileysStartupService extends ChannelStartupService {
this.logger.error('Download Media failed, trying to retry in 5 seconds...');
await new Promise((resolve) => setTimeout(resolve, 5000));
const mediaType = Object.keys(msg.message).find((key) => key.endsWith('Message'));
if (!mediaType) throw new Error('Could not determine mediaType for fallback');
try {
const media = await downloadContentFromMessage(
{
@ -3539,6 +3541,7 @@ export class BaileysStartupService extends ChannelStartupService {
this.logger.info('Download Media with downloadContentFromMessage was successful!');
} catch (fallbackErr) {
this.logger.error('Download Media with downloadContentFromMessage also failed!');
throw fallbackErr;
}
}
const typeMessage = getContentType(msg.message);