From 2e6343f2ea606eab81aa53a32ae5ae719eca3a97 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Fri, 25 Nov 2022 09:04:41 +0530 Subject: [PATCH] chore: catch errors in example --- Example/example.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Example/example.ts b/Example/example.ts index 30b3c27b4a7..9cb0ee3567c 100644 --- a/Example/example.ts +++ b/Example/example.ts @@ -1,5 +1,5 @@ import { Boom } from '@hapi/boom' -import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, isJidBroadcast, jidNormalizedUser, makeCacheableSignalKeyStore, makeInMemoryStore, MessageRetryMap, useMultiFileAuthState } from '../src' +import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, isJidBroadcast, makeCacheableSignalKeyStore, makeInMemoryStore, MessageRetryMap, useMultiFileAuthState } from '../src' import MAIN_LOGGER from '../src/Utils/logger' const logger = MAIN_LOGGER.child({ }) @@ -147,7 +147,9 @@ const startSock = async() => { if(events['contacts.update']) { for(const contact of events['contacts.update']) { if(typeof contact.imgUrl !== 'undefined') { - const newUrl = contact.imgUrl === null ? null : await sock!.profilePictureUrl(contact.id!) + const newUrl = contact.imgUrl === null + ? null + : await sock!.profilePictureUrl(contact.id!).catch(() => null) console.log( `contact ${contact.id} has a new profile pic: ${newUrl}`, )