getMessageDescriptor: Log more information if we can't find conversation

This commit is contained in:
Scott Nonnenberg 2021-10-19 18:34:35 -07:00 committed by GitHub
parent 0b57bcd36c
commit 25325622ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2832,6 +2832,7 @@ export async function startApp(): Promise<void> {
const { data, confirm } = event; const { data, confirm } = event;
const messageDescriptor = getMessageDescriptor({ const messageDescriptor = getMessageDescriptor({
confirm,
...data, ...data,
// 'message' event: for 1:1 converations, the conversation is same as sender // 'message' event: for 1:1 converations, the conversation is same as sender
destination: data.source, destination: data.source,
@ -3068,12 +3069,14 @@ export async function startApp(): Promise<void> {
// Works with 'sent' and 'message' data sent from MessageReceiver, with a little massage // Works with 'sent' and 'message' data sent from MessageReceiver, with a little massage
// at callsites to make sure both source and destination are populated. // at callsites to make sure both source and destination are populated.
const getMessageDescriptor = ({ const getMessageDescriptor = ({
confirm,
message, message,
source, source,
sourceUuid, sourceUuid,
destination, destination,
destinationUuid, destinationUuid,
}: { }: {
confirm: () => unknown;
message: ProcessedDataMessage; message: ProcessedDataMessage;
source?: string; source?: string;
sourceUuid?: string; sourceUuid?: string;
@ -3162,8 +3165,9 @@ export async function startApp(): Promise<void> {
highTrust: true, highTrust: true,
}); });
if (!id) { if (!id) {
confirm();
throw new Error( throw new Error(
'getMessageDescriptor: ensureContactIds returned falsey id' `getMessageDescriptor/${message.timestamp}: ensureContactIds returned falsey id`
); );
} }
@ -3184,6 +3188,7 @@ export async function startApp(): Promise<void> {
strictAssert(source && sourceUuid, 'Missing user number and uuid'); strictAssert(source && sourceUuid, 'Missing user number and uuid');
const messageDescriptor = getMessageDescriptor({ const messageDescriptor = getMessageDescriptor({
confirm,
...data, ...data,
// 'sent' event: the sender is always us! // 'sent' event: the sender is always us!