Merge pull request #4646 from matrix-org/bwindels/detectnetworkfailureforjoin

Use connection error to detect network problem
pull/21833/head
Bruno Windels 2020-05-26 14:18:06 +00:00 committed by GitHub
commit 3fc060c754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -273,9 +273,7 @@ class RoomViewStore extends Store {
});
let msg = err.message ? err.message : JSON.stringify(err);
console.log("Failed to join room:", msg);
// XXX: We are relying on the error message returned by browsers here.
// This isn't great, but it does generalize the error being shown to users.
if (msg && msg.startsWith("CORS request rejected")) {
if (err.name === "ConnectionError") {
msg = _t("There was an error joining the room");
}
if (err.errcode === 'M_INCOMPATIBLE_ROOM_VERSION') {