[Dev] Silence some errors (#2543)

This commit is contained in:
Alexander Zinchuk 2023-02-08 13:48:42 +01:00
parent d64afd5a4f
commit f3c45689b2
3 changed files with 6 additions and 2 deletions

View File

@ -226,7 +226,7 @@ export function toggleGroupCallStartSubscription({
return invokeRequest(new GramJs.phone.ToggleGroupCallStartSubscription({ return invokeRequest(new GramJs.phone.ToggleGroupCallStartSubscription({
call: buildInputGroupCall(call), call: buildInputGroupCall(call),
subscribed, subscribed,
}), true); }), true, undefined, undefined, undefined, true);
} }
export function leaveGroupCallPresentation({ export function leaveGroupCallPresentation({

View File

@ -192,6 +192,7 @@ export async function invokeRequest<T extends GramJs.AnyRequest>(
shouldThrow?: boolean, shouldThrow?: boolean,
shouldIgnoreUpdates?: undefined, shouldIgnoreUpdates?: undefined,
dcId?: number, dcId?: number,
shouldIgnoreErrors?: boolean,
): Promise<true | undefined>; ): Promise<true | undefined>;
export async function invokeRequest<T extends GramJs.AnyRequest>( export async function invokeRequest<T extends GramJs.AnyRequest>(
@ -200,6 +201,7 @@ export async function invokeRequest<T extends GramJs.AnyRequest>(
shouldThrow?: boolean, shouldThrow?: boolean,
shouldIgnoreUpdates?: boolean, shouldIgnoreUpdates?: boolean,
dcId?: number, dcId?: number,
shouldIgnoreErrors?: boolean,
): Promise<T['__response'] | undefined>; ): Promise<T['__response'] | undefined>;
export async function invokeRequest<T extends GramJs.AnyRequest>( export async function invokeRequest<T extends GramJs.AnyRequest>(
@ -208,6 +210,7 @@ export async function invokeRequest<T extends GramJs.AnyRequest>(
shouldThrow = false, shouldThrow = false,
shouldIgnoreUpdates = false, shouldIgnoreUpdates = false,
dcId?: number, dcId?: number,
shouldIgnoreErrors = false,
) { ) {
if (!isConnected) { if (!isConnected) {
if (DEBUG) { if (DEBUG) {
@ -234,6 +237,7 @@ export async function invokeRequest<T extends GramJs.AnyRequest>(
return shouldReturnTrue ? result && true : result; return shouldReturnTrue ? result && true : result;
} catch (err: any) { } catch (err: any) {
if (shouldIgnoreErrors) return undefined;
if (DEBUG) { if (DEBUG) {
log('INVOKE ERROR', request.className); log('INVOKE ERROR', request.className);
// eslint-disable-next-line no-console // eslint-disable-next-line no-console

View File

@ -1374,7 +1374,7 @@ export async function fetchSendAs({
}) { }) {
const result = await invokeRequest(new GramJs.channels.GetSendAs({ const result = await invokeRequest(new GramJs.channels.GetSendAs({
peer: buildInputPeer(chat.id, chat.accessHash), peer: buildInputPeer(chat.id, chat.accessHash),
})); }), undefined, undefined, undefined, undefined, true);
if (!result) { if (!result) {
return undefined; return undefined;