fix: add error handling and tests for WA Web version fetch
The fetchLatestWaWebVersion call added in #443 could crash the connection flow if the HTTP fetch fails. Wrap with .catch() to log and fall back to the default Baileys version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,7 +56,10 @@ export class WhatsAppChannel implements Channel {
|
||||
|
||||
const { state, saveCreds } = await useMultiFileAuthState(authDir);
|
||||
|
||||
const { version } = await fetchLatestWaWebVersion({});
|
||||
const { version } = await fetchLatestWaWebVersion({}).catch((err) => {
|
||||
logger.warn({ err }, 'Failed to fetch latest WA Web version, using default');
|
||||
return { version: undefined };
|
||||
});
|
||||
this.sock = makeWASocket({
|
||||
version,
|
||||
auth: {
|
||||
|
||||
Reference in New Issue
Block a user