From 024a6c06aa364dfb817ede8805adc05b4c53af00 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 10 Feb 2022 11:11:15 +0100 Subject: [PATCH] handle offline error nicer --- src/domain/session/room/RoomBeingCreatedViewModel.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/domain/session/room/RoomBeingCreatedViewModel.js b/src/domain/session/room/RoomBeingCreatedViewModel.js index f15838df..0ed82be9 100644 --- a/src/domain/session/room/RoomBeingCreatedViewModel.js +++ b/src/domain/session/room/RoomBeingCreatedViewModel.js @@ -34,7 +34,16 @@ export class RoomBeingCreatedViewModel extends ViewModel { get name() { return this._roomBeingCreated.name; } get id() { return this._roomBeingCreated.id; } get isEncrypted() { return this._roomBeingCreated.isEncrypted; } - get error() { return this._roomBeingCreated.error?.message; } + get error() { + const {error} = this._roomBeingCreated; + if (error) { + if (error.name === "ConnectionError") { + return this.i18n`You seem to be offline`; + } else { + return error.message; + } + } + } get avatarLetter() { return avatarInitials(this.name); } get avatarColorNumber() { return getIdentifierColorNumber(this._roomBeingCreated.avatarColorId); } get avatarTitle() { return this.name; }