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:
@@ -54,7 +54,10 @@ async function connectSocket(phoneNumber?: string, isReconnect = false): Promise
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
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 };
|
||||
});
|
||||
const sock = makeWASocket({
|
||||
version,
|
||||
auth: {
|
||||
|
||||
Reference in New Issue
Block a user