From b3f8d8fcd39bedf2f03a9ed732bd59708852cae2 Mon Sep 17 00:00:00 2001 From: isymchych Date: Tue, 12 Jan 2016 16:10:07 +0200 Subject: [PATCH] handle few conference errors --- conference.js | 42 +++++++++++++++++++++++++++++++++++++++--- modules/UI/UI.js | 27 +++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/conference.js b/conference.js index d75b11ec6..363e471dd 100644 --- a/conference.js +++ b/conference.js @@ -93,8 +93,8 @@ class ConferenceConnector { this._unsubscribe(); this._reject(err); } - _onConferenceFailed(err, msg = '') { - console.error('CONFERENCE FAILED:', err, msg); + _onConferenceFailed(err, ...params) { + console.error('CONFERENCE FAILED:', err, params); switch (err) { // room is locked by the password case ConferenceErrors.PASSWORD_REQUIRED: @@ -105,7 +105,10 @@ class ConferenceConnector { break; case ConferenceErrors.CONNECTION_ERROR: - APP.UI.notifyConnectionFailed(msg); + { + let [msg] = params; + APP.UI.notifyConnectionFailed(msg); + } break; case ConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE: @@ -123,6 +126,39 @@ class ConferenceConnector { AuthHandler.requireAuth(APP.conference.roomName); break; + case ConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE: + APP.UI.notifyBridgeDown(); + break; + + case ConferenceErrors.RESERVATION_ERROR: + { + let [code, msg] = params; + APP.UI.notifyReservationError(code, msg); + } + break; + + case ConferenceErrors.GRACEFUL_SHUTDOWN: + APP.UI.notifyGracefulShudown(); + break; + + case ConferenceErrors.JINGLE_FATAL_ERROR: + APP.UI.notifyInternalError(); + break; + + case ConferenceErrors.CONFERENCE_DESTROYED: + { + let [reason] = params; + APP.UI.notifyConferenceDestroyed(reason); + } + break; + + case ConferenceErrors.CHAT_ERROR: + { + let [code, msg] = params; + APP.UI.showChatError(code, msg); + } + break; + default: this._handleConferenceFailed(err, msg); } diff --git a/modules/UI/UI.js b/modules/UI/UI.js index caa424da5..ff7da31f7 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -139,10 +139,29 @@ UI.notifyKicked = function () { messageHandler.openMessageDialog("dialog.sessTerminated", "dialog.kickMessage"); }; +UI.notifyConferenceDestroyed = function (reason) { + //FIXME: use Session Terminated from translation, but + // 'reason' text comes from XMPP packet and is not translated + var title = APP.translation.generateTranslationHTML("dialog.sessTerminated"); + messageHandler.openDialog( + title, reason, true, {}, + function (event, value, message, formVals) { + return false; + } + ); +}; + UI.notifyBridgeDown = function () { messageHandler.showError("dialog.error", "dialog.bridgeUnavailable"); }; +UI.showChatError = function (err, msg) { + if (interfaceConfig.filmStripOnly) { + return; + } + Chat.chatAddError(err, msg); +}; + UI.changeDisplayName = function (id, displayName) { ContactList.onDisplayNameChange(id, displayName); SettingsMenu.onDisplayNameChange(id, displayName); @@ -360,10 +379,6 @@ UI.addRemoteStream = function (stream) { VideoLayout.onRemoteStreamAdded(stream); }; -function chatAddError(errorMessage, originalText) { - return Chat.chatAddError(errorMessage, originalText); -} - UI.setSubject = function (subject) { Chat.setSubject(subject); }; @@ -769,6 +784,10 @@ UI.notifyTokenAuthFailed = function () { messageHandler.showError("dialog.error", "dialog.tokenAuthFailed"); }; +UI.notifyInternalError = function () { + UI.messageHandler.showError("dialog.sorry", "dialog.internalError"); +}; + UI.updateAuthInfo = function (isAuthEnabled, login) { let loggedIn = !!login;