-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Throw exception if download media fail #1704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Reviewer's GuideThe PR updates the Baileys startup service to immediately fail when download retries cannot determine the media type or when the fallback download itself fails, ensuring incomplete media doesn’t propagate further. Sequence diagram for updated media download error handlingsequenceDiagram
participant Service as BaileysStartupService
participant Logger
participant Downloader as downloadContentFromMessage
participant ErrorHandler
Service->Downloader: Attempt to download media
alt Download fails
Service->Logger: Log error (Download Media failed, retrying...)
Service->Service: Wait 5 seconds
Service->Service: Determine mediaType
alt mediaType not found
Service->ErrorHandler: Throw Error('Could not determine mediaType for fallback')
else mediaType found
Service->Downloader: Attempt fallback download
alt Fallback download fails
Service->Logger: Log error (Fallback download failed)
Service->ErrorHandler: Throw fallbackErr
else Fallback download succeeds
Service->Logger: Log success
end
end
else Download succeeds
Service->Logger: Log success
end
Class diagram for BaileysStartupService error handling changesclassDiagram
class BaileysStartupService {
+downloadMedia(msg)
}
BaileysStartupService : +logger
BaileysStartupService : +downloadMedia(msg)
BaileysStartupService : Throws Error if mediaType not found
BaileysStartupService : Throws fallbackErr if fallback download fails
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Opa. De curiosidade qual erro teve? |
as medias não estavam gerando o base64, aleatoriamente, tava dando um erro de timeout dentro da bailyes, ai como não tinha a exceção não dava pra ver no log |
Caras, eu perdi horas tentando debugar um erro nada a ver porque essa função não estava levantando uma exceção quando falhava no download, isso fazia os objetos chegarem incompletos no restante do codigo, gerando outros erros.
Ref: #1699
Summary by Sourcery
Throw errors when media download fails to ensure failures are surfaced
Bug Fixes: