From f5dacb4e42bd3daf6b6633cebb0613d362494b61 Mon Sep 17 00:00:00 2001 From: Kaki In <91763754+Kaki-In@users.noreply.github.com> Date: Thu, 28 Jul 2022 10:26:59 +0200 Subject: [PATCH] Fixed last check --- src/domain/session/room/RoomViewModel.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index cecbb27f..249d04f0 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -205,14 +205,15 @@ export class RoomViewModel extends ViewModel { await roomStatusObserver.waitFor(status => status === RoomStatus.Joined); this.navigation.push("room", roomId); } catch (err) { - if ((exc.statusCode ?? exc.status) === 400) { - const exc = new Error(`/join : '${roomName}' was not legal room ID or room alias`); - } else if ((exc.statusCode ?? exc.status) === 404 || (exc.statusCode ?? exc.status) === 502 || exc.message == "Internal Server Error") { - const exc = new Error(`/join : room '${roomName}' not found`); - } else if ((exc.statusCode ?? exc.status) === 403) { - const exc = new Error(`/join : you're not invited to join '${roomName}'`); + let exc; + if ((err.statusCode ?? err.status) === 400) { + exc = new Error(`/join : '${roomName}' was not legal room ID or room alias`); + } else if ((err.statusCode ?? err.status) === 404 || (err.statusCode ?? err.status) === 502 || err.message == "Internal Server Error") { + exc = new Error(`/join : room '${roomName}' not found`); + } else if ((err.statusCode ?? err.status) === 403) { + exc = new Error(`/join : you're not invited to join '${roomName}'`); } else { - const exc = err; + exc = err; } this._sendError = exc; this._timelineError = null;