From 6fc5bf38a7412c8a5b0c829a482dc87522a0da7d Mon Sep 17 00:00:00 2001 From: devlikepro Date: Sun, 19 Jan 2025 13:53:38 +0700 Subject: [PATCH] [core] NOWEB - handle not found profile picture --- src/core/engines/noweb/session.noweb.core.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/core/engines/noweb/session.noweb.core.ts b/src/core/engines/noweb/session.noweb.core.ts index 51f80c67..87344d61 100644 --- a/src/core/engines/noweb/session.noweb.core.ts +++ b/src/core/engines/noweb/session.noweb.core.ts @@ -1113,8 +1113,18 @@ export class WhatsappSessionNoWebCore extends WhatsappSession { if (isJidStatusBroadcast(id)) { return null; } - const url = await this.sock.profilePictureUrl(contact, 'image'); - return url; + try { + const url = await this.sock.profilePictureUrl(contact, 'image'); + return url; + } catch (err) { + if (err.message == 'item-not-found') { + return null; + } + if (err.message == 'not-authorized') { + return null; + } + throw err; + } } public async blockContact(request: ContactRequest) {