Skip to content

Commit

Permalink
chore: catch errors in example
Browse files Browse the repository at this point in the history
  • Loading branch information
adiwajshing committed Nov 25, 2022
1 parent b20a3b9 commit 2e6343f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Example/example.ts
Original file line number Diff line number Diff line change
@@ -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({ })
Expand Down Expand Up @@ -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}`,
)
Expand Down

0 comments on commit 2e6343f

Please sign in to comment.