getProfiles: Better logging; don't let promise propagate
This commit is contained in:
parent
83e0e5d33b
commit
a39e46db5c
7 changed files with 49 additions and 12 deletions
|
@ -4645,7 +4645,11 @@ export class ConversationModel extends window.Backbone
|
||||||
|
|
||||||
onChangeProfileKey(): void {
|
onChangeProfileKey(): void {
|
||||||
if (isDirectConversation(this.attributes)) {
|
if (isDirectConversation(this.attributes)) {
|
||||||
void this.getProfiles();
|
drop(
|
||||||
|
this.getProfiles().catch(() => {
|
||||||
|
/* nothing to do here; logging already happened */
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1048,7 +1048,11 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
switch (error.name) {
|
switch (error.name) {
|
||||||
case 'OutgoingIdentityKeyError': {
|
case 'OutgoingIdentityKeyError': {
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
promises.push(conversation.getProfiles());
|
promises.push(
|
||||||
|
conversation.getProfiles().catch(() => {
|
||||||
|
/* nothing to do here; logging already happened */
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,10 +142,17 @@ export async function routineProfileRefresh({
|
||||||
);
|
);
|
||||||
successCount += 1;
|
successCount += 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.error(
|
if ('code' in err) {
|
||||||
`${logId}: refreshed profile for ${conversation.idForLogging()}`,
|
log.warn(
|
||||||
Errors.toLogFormat(err)
|
`${logId}: refreshed profile for ${conversation.idForLogging()},`,
|
||||||
);
|
`got error code ${err.code}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
log.error(
|
||||||
|
`${logId}: refreshed profile for ${conversation.idForLogging()}`,
|
||||||
|
Errors.toLogFormat(err)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1601,7 +1601,13 @@ async function processRemoteRecords(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Intentionally not awaiting
|
// Intentionally not awaiting
|
||||||
needProfileFetch.map(convo => drop(convo.getProfiles()));
|
needProfileFetch.map(convo =>
|
||||||
|
drop(
|
||||||
|
convo.getProfiles().catch(() => {
|
||||||
|
/* nothing to do here; logging already happened */
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Collect full map of previously and currently unknown records
|
// Collect full map of previously and currently unknown records
|
||||||
const unknownRecords: Map<string, UnknownRecord> = new Map();
|
const unknownRecords: Map<string, UnknownRecord> = new Map();
|
||||||
|
|
|
@ -1064,7 +1064,11 @@ export async function mergeContactRecord(
|
||||||
) {
|
) {
|
||||||
// Local name doesn't match remote name, fetch profile
|
// Local name doesn't match remote name, fetch profile
|
||||||
if (localName) {
|
if (localName) {
|
||||||
void conversation.getProfiles();
|
drop(
|
||||||
|
conversation.getProfiles().catch(() => {
|
||||||
|
/* nothing to do here; logging already happened */
|
||||||
|
})
|
||||||
|
);
|
||||||
details.push('refreshing profile');
|
details.push('refreshing profile');
|
||||||
} else {
|
} else {
|
||||||
conversation.set({
|
conversation.set({
|
||||||
|
|
|
@ -11,6 +11,8 @@ export async function toggleVerification(id: string): Promise<void> {
|
||||||
export async function reloadProfiles(id: string): Promise<void> {
|
export async function reloadProfiles(id: string): Promise<void> {
|
||||||
const contact = window.getConversations().get(id);
|
const contact = window.getConversations().get(id);
|
||||||
if (contact) {
|
if (contact) {
|
||||||
await contact.getProfiles();
|
await contact.getProfiles().catch(() => {
|
||||||
|
/* nothing to do here; logging already happened */
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2741,7 +2741,11 @@ function getProfilesForConversation(conversationId: string): NoopActionType {
|
||||||
throw new Error('getProfilesForConversation: no conversation found');
|
throw new Error('getProfilesForConversation: no conversation found');
|
||||||
}
|
}
|
||||||
|
|
||||||
void conversation.getProfiles();
|
drop(
|
||||||
|
conversation.getProfiles().catch(() => {
|
||||||
|
/* nothing to do here; logging already happened */
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'NOOP',
|
type: 'NOOP',
|
||||||
|
@ -2765,7 +2769,11 @@ function conversationStoppedByMissingVerification(payload: {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intentionally not awaiting here
|
// Intentionally not awaiting here
|
||||||
void conversation.getProfiles();
|
drop(
|
||||||
|
conversation.getProfiles().catch(() => {
|
||||||
|
/* nothing to do here; logging already happened */
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -4274,7 +4282,9 @@ function onConversationOpened(
|
||||||
conversation.throttledGetProfiles !== undefined,
|
conversation.throttledGetProfiles !== undefined,
|
||||||
'Conversation model should be initialized'
|
'Conversation model should be initialized'
|
||||||
);
|
);
|
||||||
await conversation.throttledGetProfiles();
|
await conversation.throttledGetProfiles().catch(() => {
|
||||||
|
/* nothing to do here; logging already happened */
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(conversation.updateVerified());
|
drop(conversation.updateVerified());
|
||||||
|
|
Loading…
Reference in a new issue