From 302131c447d30300ae7411b6e7df31f5acb120c7 Mon Sep 17 00:00:00 2001 From: Kaki In <91763754+Kaki-In@users.noreply.github.com> Date: Thu, 28 Jul 2022 10:14:21 +0200 Subject: [PATCH] Review last checks --- src/domain/session/room/RoomViewModel.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index 124f6e9c..cecbb27f 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -198,22 +198,21 @@ export class RoomViewModel extends ViewModel { } } - async joinRoom(roomName) { - } - async _processCommandJoin(roomName) { try { const roomId = await this._options.client.session.joinRoom(roomName); const roomStatusObserver = await this._options.client.session.observeRoomStatus(roomId); await roomStatusObserver.waitFor(status => status === RoomStatus.Joined); this.navigation.push("room", roomId); - } catch (exc) { + } catch (err) { if ((exc.statusCode ?? exc.status) === 400) { - exc = new Error(`/join : '${roomName}' was not legal room ID or room alias`); + 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") { - exc = new Error(`/join : room '${roomName}' not found`); + const exc = new Error(`/join : room '${roomName}' not found`); } else if ((exc.statusCode ?? exc.status) === 403) { - exc = new Error(`/join : you're not invited to join '${roomName}'`); + const exc = new Error(`/join : you're not invited to join '${roomName}'`); + } else { + const exc = err; } this._sendError = exc; this._timelineError = null;