Added PoW error.

pull/115/head
Mikunj 6 years ago
parent e50a199f83
commit 6bcb259919

@ -846,7 +846,8 @@
e.name === 'OutgoingMessageError' ||
e.name === 'SendMessageNetworkError' ||
e.name === 'SignedPreKeyRotationError' ||
e.name === 'OutgoingIdentityKeyError'
e.name === 'OutgoingIdentityKeyError' ||
e.name === 'PoWError'
);
},

@ -127,6 +127,21 @@
}
inherit(Error, UnregisteredUserError);
function PoWError(number, error) {
// eslint-disable-next-line prefer-destructuring
this.number = number.split('.')[0];
ReplayableError.call(this, {
name: 'PoWError',
message: 'Failed to calculate PoW',
});
if (error) {
appendStack(this, error);
}
}
inherit(ReplayableError, PoWError);
window.textsecure.UnregisteredUserError = UnregisteredUserError;
window.textsecure.SendMessageNetworkError = SendMessageNetworkError;
window.textsecure.IncomingIdentityKeyError = IncomingIdentityKeyError;
@ -135,4 +150,5 @@
window.textsecure.OutgoingMessageError = OutgoingMessageError;
window.textsecure.MessageError = MessageError;
window.textsecure.SignedPreKeyRotationError = SignedPreKeyRotationError;
window.textsecure.PoWError = PoWError;
})();

@ -195,6 +195,8 @@ OutgoingMessage.prototype = {
throw new textsecure.UnregisteredUserError(number, e);
}
throw new textsecure.SendMessageNetworkError(number, '', e, timestamp);
} else if (e.name === 'TimedOutError') {
throw new textsecure.PoWError(number, e);
}
throw e;
}

Loading…
Cancel
Save