diff --git a/background.html b/background.html
index 2147cad7..441cb5a3 100644
--- a/background.html
+++ b/background.html
@@ -211,7 +211,7 @@
diff --git a/js/libtextsecure.js b/js/libtextsecure.js
index c58e39a1..9c2dac64 100644
--- a/js/libtextsecure.js
+++ b/js/libtextsecure.js
@@ -39945,8 +39945,12 @@ window.textsecure.messaging = function() {
}
});
});
- } else
+ } else if (error.message !== "Identity key changed at session save time") {
registerError(number, "Failed to create or send message", error);
+ } else {
+ error = new textsecure.OutgoingIdentityKeyError(number, message.toArrayBuffer(), timestamp);
+ registerError(number, "Identity key changed", error);
+ }
});
}
diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js
index 23328239..89ad3c37 100644
--- a/libtextsecure/sendmessage.js
+++ b/libtextsecure/sendmessage.js
@@ -215,8 +215,12 @@ window.textsecure.messaging = function() {
}
});
});
- } else
+ } else if (error.message !== "Identity key changed at session save time") {
registerError(number, "Failed to create or send message", error);
+ } else {
+ error = new textsecure.OutgoingIdentityKeyError(number, message.toArrayBuffer(), timestamp);
+ registerError(number, "Identity key changed", error);
+ }
});
}