Add human readable version of errors

This commit is contained in:
Matt Corallo 2014-05-27 21:29:44 +02:00
parent 753a950816
commit 68131a6e2a
5 changed files with 55 additions and 42 deletions

View file

@ -417,10 +417,7 @@ window.textsecure.crypto = new function() {
} else {
// ...otherwise create an error that the UI will pick up and ask the user if they want to re-negotiate
// TODO: Save the message for possible later renegotiation
var error = new Error("Received message with unknown identity key");
error.name = "WarnTryAgainError";
error.full_message = "The identity of the sender has changed. This may be malicious, or the sender may have simply reinstalled TextSecure.";
throw new error;
textsecure.throwHumanError("Received message with unknown identity key", "WarnTryAgainError", "The identity of the sender has changed. This may be malicious, or the sender may have simply reinstalled TextSecure.");
}
}
return initSession(false, preKeyPair, encodedNumber, toArrayBuffer(message.identityKey), toArrayBuffer(message.baseKey))