diff --git a/ts/textsecure/getKeysForIdentifier.ts b/ts/textsecure/getKeysForIdentifier.ts index a54106de68..4fb8a466f3 100644 --- a/ts/textsecure/getKeysForIdentifier.ts +++ b/ts/textsecure/getKeysForIdentifier.ts @@ -41,8 +41,11 @@ export async function getKeysForIdentifier( if (theirUuid) { await window.textsecure.storage.protocol.archiveAllSessions(theirUuid); } + + throw new UnregisteredUserError(identifier, error); } - throw new UnregisteredUserError(identifier, error); + + throw error; } } diff --git a/ts/util/sendToGroup.ts b/ts/util/sendToGroup.ts index a0acc652f2..f6ef1151b7 100644 --- a/ts/util/sendToGroup.ts +++ b/ts/util/sendToGroup.ts @@ -168,7 +168,18 @@ export async function sendContentMessageToGroup({ sendType, timestamp, }); - } catch (error) { + } catch (error: unknown) { + if (!(error instanceof Error)) { + throw error; + } + + if (error.name.includes('untrusted identity')) { + log.error( + `sendToGroup/${logId}: Failed with 'untrusted identity' error, re-throwing` + ); + throw error; + } + log.error( `sendToGroup/${logId}: Sender Key send failed, logging, proceeding to normal send`, error && error.stack ? error.stack : error @@ -1084,6 +1095,7 @@ async function fetchKeysForIdentifiers( 'fetchKeysForIdentifiers: Failed to fetch keys:', error && error.stack ? error.stack : error ); + throw error; } }