diff --git a/ts/background.ts b/ts/background.ts index 180eb0f412d0..178e7e8969da 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -1772,7 +1772,9 @@ export async function startApp(): Promise { } catch (error) { log.error( 'connect: Error refreshing remote config:', - Errors.toLogFormat(error) + isNumber(error.code) + ? `code: ${error.code}` + : Errors.toLogFormat(error) ); } } diff --git a/ts/services/profiles.ts b/ts/services/profiles.ts index 2b69c0236e43..a97b9c227487 100644 --- a/ts/services/profiles.ts +++ b/ts/services/profiles.ts @@ -3,6 +3,7 @@ import type { ProfileKeyCredentialRequestContext } from '@signalapp/libsignal-client/zkgroup'; import PQueue from 'p-queue'; +import { isNumber } from 'lodash'; import type { ConversationModel } from '../models/conversations'; import type { @@ -496,7 +497,9 @@ async function doGetProfile(c: ConversationModel): Promise { log.warn( 'getProfile failure:', idForLogging, - Errors.toLogFormat(error) + isNumber(error.code) + ? `code: ${error.code}` + : Errors.toLogFormat(error) ); return; } diff --git a/ts/textsecure/OutgoingMessage.ts b/ts/textsecure/OutgoingMessage.ts index 9a41dae63b02..141f004c1398 100644 --- a/ts/textsecure/OutgoingMessage.ts +++ b/ts/textsecure/OutgoingMessage.ts @@ -539,9 +539,12 @@ export default class OutgoingMessage { }, async (error: Error) => { if ( - error instanceof HTTPError && + error instanceof SendMessageNetworkError && (error.code === 401 || error.code === 403) ) { + log.warn( + `OutgoingMessage.doSendMessage: Failing over to unsealed send for identifier ${identifier}` + ); if (this.failoverIdentifiers.indexOf(identifier) === -1) { this.failoverIdentifiers.push(identifier); } diff --git a/ts/util/sendToGroup.ts b/ts/util/sendToGroup.ts index 1184e96a4d4d..6f5a3c643d7c 100644 --- a/ts/util/sendToGroup.ts +++ b/ts/util/sendToGroup.ts @@ -843,7 +843,14 @@ export function _shouldFailSend(error: unknown, logId: string): boolean { if (error instanceof SendMessageProtoError) { if (!error.errors || !error.errors.length) { - logError('SendMessageProtoError had no errors, failing.'); + logError('SendMessageProtoError had no errors but was thrown! Failing.'); + return true; + } + + if (error.successfulIdentifiers && error.successfulIdentifiers.length > 0) { + logError( + 'SendMessageProtoError had successful sends; no further sends needed. Failing.' + ); return true; }