Dont flag endorsements fail on unregistered error

Co-authored-by: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2024-09-17 20:15:49 -05:00 committed by GitHub
parent 8de8543637
commit 034f963fcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 12 deletions

View file

@ -5,16 +5,22 @@ import { getEnvironment, Environment } from '../environment';
import * as log from '../logging/log';
import * as Errors from '../types/errors';
/**
* In development, starts the debugger.
*/
export function devDebugger(): void {
if (getEnvironment() === Environment.Development) {
debugger; // eslint-disable-line no-debugger
}
}
/**
* In production and beta, logs a warning and continues. For development it
* starts the debugger.
*/
export function softAssert(condition: unknown, message: string): void {
if (!condition) {
if (getEnvironment() === Environment.Development) {
debugger; // eslint-disable-line no-debugger
}
devDebugger();
const err = new Error(message);
log.warn('softAssert failure:', Errors.toLogFormat(err));
}
@ -30,9 +36,7 @@ export function assertDev(
if (!condition) {
const err = new Error(message);
if (getEnvironment() !== Environment.PackagedApp) {
if (getEnvironment() === Environment.Development) {
debugger; // eslint-disable-line no-debugger
}
devDebugger();
throw err;
}
log.error('assert failure:', Errors.toLogFormat(err));

View file

@ -11,7 +11,7 @@ import {
toGroupSendToken,
type GroupSendEndorsementsData,
} from '../types/GroupSendEndorsements';
import { assertDev, strictAssert } from './assert';
import { devDebugger, strictAssert } from './assert';
import {
GroupSecretParams,
GroupSendEndorsement,
@ -277,5 +277,5 @@ export function onFailedToSendWithEndorsements(error: Error): void {
if (window.SignalCI) {
window.SignalCI.handleEvent('fatalTestError', error);
}
assertDev(false, 'We should never fail to send with endorsements');
devDebugger();
}

View file

@ -1477,13 +1477,13 @@ async function fetchKeysForServiceId(
await DataWriter.updateConversation(emptyConversation.attributes);
}
} catch (error: unknown) {
if (useGroupSendEndorsement) {
onFailedToSendWithEndorsements(error as Error);
}
if (error instanceof UnregisteredUserError) {
await markServiceIdUnregistered(serviceId);
return;
}
if (useGroupSendEndorsement) {
onFailedToSendWithEndorsements(error as Error);
}
log.error(
`fetchKeysForServiceId: Error fetching ${
devices || 'all'