Dont flag endorsements fail on unregistered error
This commit is contained in:
parent
c11a894ad1
commit
6deb1594fa
3 changed files with 16 additions and 12 deletions
|
@ -5,16 +5,22 @@ import { getEnvironment, Environment } from '../environment';
|
||||||
import * as log from '../logging/log';
|
import * as log from '../logging/log';
|
||||||
import * as Errors from '../types/errors';
|
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
|
* In production and beta, logs a warning and continues. For development it
|
||||||
* starts the debugger.
|
* starts the debugger.
|
||||||
*/
|
*/
|
||||||
export function softAssert(condition: unknown, message: string): void {
|
export function softAssert(condition: unknown, message: string): void {
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
if (getEnvironment() === Environment.Development) {
|
devDebugger();
|
||||||
debugger; // eslint-disable-line no-debugger
|
|
||||||
}
|
|
||||||
|
|
||||||
const err = new Error(message);
|
const err = new Error(message);
|
||||||
log.warn('softAssert failure:', Errors.toLogFormat(err));
|
log.warn('softAssert failure:', Errors.toLogFormat(err));
|
||||||
}
|
}
|
||||||
|
@ -30,9 +36,7 @@ export function assertDev(
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
const err = new Error(message);
|
const err = new Error(message);
|
||||||
if (getEnvironment() !== Environment.PackagedApp) {
|
if (getEnvironment() !== Environment.PackagedApp) {
|
||||||
if (getEnvironment() === Environment.Development) {
|
devDebugger();
|
||||||
debugger; // eslint-disable-line no-debugger
|
|
||||||
}
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
log.error('assert failure:', Errors.toLogFormat(err));
|
log.error('assert failure:', Errors.toLogFormat(err));
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
toGroupSendToken,
|
toGroupSendToken,
|
||||||
type GroupSendEndorsementsData,
|
type GroupSendEndorsementsData,
|
||||||
} from '../types/GroupSendEndorsements';
|
} from '../types/GroupSendEndorsements';
|
||||||
import { assertDev, strictAssert } from './assert';
|
import { devDebugger, strictAssert } from './assert';
|
||||||
import {
|
import {
|
||||||
GroupSecretParams,
|
GroupSecretParams,
|
||||||
GroupSendEndorsement,
|
GroupSendEndorsement,
|
||||||
|
@ -277,5 +277,5 @@ export function onFailedToSendWithEndorsements(error: Error): void {
|
||||||
if (window.SignalCI) {
|
if (window.SignalCI) {
|
||||||
window.SignalCI.handleEvent('fatalTestError', error);
|
window.SignalCI.handleEvent('fatalTestError', error);
|
||||||
}
|
}
|
||||||
assertDev(false, 'We should never fail to send with endorsements');
|
devDebugger();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1477,13 +1477,13 @@ async function fetchKeysForServiceId(
|
||||||
await DataWriter.updateConversation(emptyConversation.attributes);
|
await DataWriter.updateConversation(emptyConversation.attributes);
|
||||||
}
|
}
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
if (useGroupSendEndorsement) {
|
|
||||||
onFailedToSendWithEndorsements(error as Error);
|
|
||||||
}
|
|
||||||
if (error instanceof UnregisteredUserError) {
|
if (error instanceof UnregisteredUserError) {
|
||||||
await markServiceIdUnregistered(serviceId);
|
await markServiceIdUnregistered(serviceId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (useGroupSendEndorsement) {
|
||||||
|
onFailedToSendWithEndorsements(error as Error);
|
||||||
|
}
|
||||||
log.error(
|
log.error(
|
||||||
`fetchKeysForServiceId: Error fetching ${
|
`fetchKeysForServiceId: Error fetching ${
|
||||||
devices || 'all'
|
devices || 'all'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue