remove unused replyable error types

pull/1495/head
Audric Ackermann 4 years ago
parent bb3641b39a
commit 66a6190f2b

@ -35,18 +35,6 @@
}
inherit(Error, ReplayableError);
function IncomingIdentityKeyError(number, message, key) {
// eslint-disable-next-line prefer-destructuring
this.number = number.split('.')[0];
this.identityKey = key;
ReplayableError.call(this, {
name: 'IncomingIdentityKeyError',
message: `The identity of ${this.number} has changed.`,
});
}
inherit(ReplayableError, IncomingIdentityKeyError);
function SendMessageNetworkError(number, jsonData, httpError) {
this.number = number;
this.code = httpError.code;
@ -60,18 +48,6 @@
}
inherit(ReplayableError, SendMessageNetworkError);
function MessageError(message, httpError) {
this.code = httpError.code;
ReplayableError.call(this, {
name: 'MessageError',
message: httpError.message,
});
appendStack(this, httpError);
}
inherit(ReplayableError, MessageError);
function EmptySwarmError(number, message) {
// eslint-disable-next-line prefer-destructuring
this.number = number.split('.')[0];
@ -83,16 +59,6 @@
}
inherit(ReplayableError, EmptySwarmError);
function DNSResolutionError(message) {
// eslint-disable-next-line prefer-destructuring
ReplayableError.call(this, {
name: 'DNSResolutionError',
message: `Error resolving url: ${message}`,
});
}
inherit(ReplayableError, DNSResolutionError);
function NotFoundError(message, error) {
this.name = 'NotFoundError';
this.message = message;
@ -161,16 +127,6 @@
}
}
function PublicTokenError(message) {
this.name = 'PublicTokenError';
ReplayableError.call(this, {
name: 'PublicTokenError',
message,
});
}
inherit(ReplayableError, PublicTokenError);
function TimestampError(message) {
this.name = 'TimeStampError';
@ -194,17 +150,13 @@
}
window.textsecure.SendMessageNetworkError = SendMessageNetworkError;
window.textsecure.IncomingIdentityKeyError = IncomingIdentityKeyError;
window.textsecure.ReplayableError = ReplayableError;
window.textsecure.MessageError = MessageError;
window.textsecure.EmptySwarmError = EmptySwarmError;
window.textsecure.SeedNodeError = SeedNodeError;
window.textsecure.DNSResolutionError = DNSResolutionError;
window.textsecure.HTTPError = HTTPError;
window.textsecure.NotFoundError = NotFoundError;
window.textsecure.WrongSwarmError = WrongSwarmError;
window.textsecure.WrongDifficultyError = WrongDifficultyError;
window.textsecure.TimestampError = TimestampError;
window.textsecure.PublicChatError = PublicChatError;
window.textsecure.PublicTokenError = PublicTokenError;
})();

@ -5,18 +5,14 @@ export interface LibTextsecure {
crypto: LibTextsecureCryptoInterface;
storage: any;
SendMessageNetworkError: any;
IncomingIdentityKeyError: any;
ReplayableError: any;
MessageError: any;
EmptySwarmError: any;
SeedNodeError: any;
DNSResolutionError: any;
HTTPError: any;
NotFoundError: any;
WrongSwarmError: any;
WrongDifficultyError: any;
TimestampError: any;
PublicChatError: any;
PublicTokenError: any;
createTaskWithTimeout(task: any, id: any, options?: any): Promise<any>;
}

@ -930,9 +930,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
public removeOutgoingErrors(number: string) {
const errors = _.partition(
this.get('errors'),
e =>
e.number === number &&
(e.name === 'MessageError' || e.name === 'SendMessageNetworkError')
e => e.number === number && e.name === 'SendMessageNetworkError'
);
this.set({ errors: errors[1] });
return errors[0][0];

Loading…
Cancel
Save