From f3c45689b2ce6c7ddddf380dd80323b5e9a44bc7 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 8 Feb 2023 13:48:42 +0100 Subject: [PATCH] [Dev] Silence some errors (#2543) --- src/api/gramjs/methods/calls.ts | 2 +- src/api/gramjs/methods/client.ts | 4 ++++ src/api/gramjs/methods/messages.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/gramjs/methods/calls.ts b/src/api/gramjs/methods/calls.ts index 639652277..927966117 100644 --- a/src/api/gramjs/methods/calls.ts +++ b/src/api/gramjs/methods/calls.ts @@ -226,7 +226,7 @@ export function toggleGroupCallStartSubscription({ return invokeRequest(new GramJs.phone.ToggleGroupCallStartSubscription({ call: buildInputGroupCall(call), subscribed, - }), true); + }), true, undefined, undefined, undefined, true); } export function leaveGroupCallPresentation({ diff --git a/src/api/gramjs/methods/client.ts b/src/api/gramjs/methods/client.ts index 89cf53712..306a15aed 100644 --- a/src/api/gramjs/methods/client.ts +++ b/src/api/gramjs/methods/client.ts @@ -192,6 +192,7 @@ export async function invokeRequest( shouldThrow?: boolean, shouldIgnoreUpdates?: undefined, dcId?: number, + shouldIgnoreErrors?: boolean, ): Promise; export async function invokeRequest( @@ -200,6 +201,7 @@ export async function invokeRequest( shouldThrow?: boolean, shouldIgnoreUpdates?: boolean, dcId?: number, + shouldIgnoreErrors?: boolean, ): Promise; export async function invokeRequest( @@ -208,6 +210,7 @@ export async function invokeRequest( shouldThrow = false, shouldIgnoreUpdates = false, dcId?: number, + shouldIgnoreErrors = false, ) { if (!isConnected) { if (DEBUG) { @@ -234,6 +237,7 @@ export async function invokeRequest( return shouldReturnTrue ? result && true : result; } catch (err: any) { + if (shouldIgnoreErrors) return undefined; if (DEBUG) { log('INVOKE ERROR', request.className); // eslint-disable-next-line no-console diff --git a/src/api/gramjs/methods/messages.ts b/src/api/gramjs/methods/messages.ts index ba75d49dc..af95379c6 100644 --- a/src/api/gramjs/methods/messages.ts +++ b/src/api/gramjs/methods/messages.ts @@ -1374,7 +1374,7 @@ export async function fetchSendAs({ }) { const result = await invokeRequest(new GramJs.channels.GetSendAs({ peer: buildInputPeer(chat.id, chat.accessHash), - })); + }), undefined, undefined, undefined, undefined, true); if (!result) { return undefined;