diff --git a/JitsiConnectionErrors.spec.ts b/JitsiConnectionErrors.spec.ts index b1f6bad570..191d58851a 100644 --- a/JitsiConnectionErrors.spec.ts +++ b/JitsiConnectionErrors.spec.ts @@ -4,6 +4,7 @@ import * as exported from "./JitsiConnectionErrors"; describe( "/JitsiConnectionErrors members", () => { const { + CONFERENCE_REQUEST_FAILED, CONNECTION_DROPPED_ERROR, NOT_LIVE_ERROR, OTHER_ERROR, @@ -14,13 +15,16 @@ describe( "/JitsiConnectionErrors members", () => { } = exported; it( "known members", () => { + expect( CONFERENCE_REQUEST_FAILED ).toBe( 'connection.conferenceRequestFailed' ); expect( CONNECTION_DROPPED_ERROR ).toBe( 'connection.droppedError' ); + expect( NOT_LIVE_ERROR ).toBe( 'connection.notLiveError' ); expect( OTHER_ERROR ).toBe( 'connection.otherError' ); expect( PASSWORD_REQUIRED ).toBe( 'connection.passwordRequired' ); expect( SERVER_ERROR ).toBe( 'connection.serverError' ); expect( JitsiConnectionErrors ).toBeDefined(); + expect( JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED ).toBe( 'connection.conferenceRequestFailed' ); expect( JitsiConnectionErrors.CONNECTION_DROPPED_ERROR ).toBe( 'connection.droppedError' ); expect( JitsiConnectionErrors.NOT_LIVE_ERROR ).toBe( 'connection.notLiveError' ); expect( JitsiConnectionErrors.OTHER_ERROR ).toBe( 'connection.otherError' ); diff --git a/JitsiConnectionErrors.ts b/JitsiConnectionErrors.ts index 1a6d7122b6..0a2d395c0a 100644 --- a/JitsiConnectionErrors.ts +++ b/JitsiConnectionErrors.ts @@ -3,6 +3,11 @@ */ export enum JitsiConnectionErrors { + /** + * When the conference-request to jicofo fails. + */ + CONFERENCE_REQUEST_FAILED = "connection.conferenceRequestFailed", + /** * Indicates that the connection was dropped with an error which was most likely * caused by some networking issues. The dropped term in this context means that @@ -39,6 +44,7 @@ export enum JitsiConnectionErrors { }; // exported for backward compatibility +export const CONFERENCE_REQUEST_FAILED = JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED; export const CONNECTION_DROPPED_ERROR = JitsiConnectionErrors.CONNECTION_DROPPED_ERROR; export const NOT_LIVE_ERROR = JitsiConnectionErrors.NOT_LIVE_ERROR; export const OTHER_ERROR = JitsiConnectionErrors.OTHER_ERROR; diff --git a/modules/xmpp/moderator.js b/modules/xmpp/moderator.js index 6da7f92acf..78ae165776 100644 --- a/modules/xmpp/moderator.js +++ b/modules/xmpp/moderator.js @@ -3,7 +3,7 @@ import { getLogger } from '@jitsi/logger'; import $ from 'jquery'; import { $iq } from 'strophe.js'; -import { NOT_LIVE_ERROR } from '../../JitsiConnectionErrors'; +import { CONFERENCE_REQUEST_FAILED, NOT_LIVE_ERROR } from '../../JitsiConnectionErrors'; import { CONNECTION_FAILED, CONNECTION_REDIRECTED } from '../../JitsiConnectionEvents'; import Settings from '../settings/Settings'; import Listenable from '../util/Listenable'; @@ -339,7 +339,7 @@ export default class Moderator extends Listenable { }) .catch(error => { logger.warn(`Error: ${error}`); - this._handleError(roomJid, undefined, undefined, resolve, reject); + this._handleError(roomJid, undefined, undefined, resolve, () => reject(error)); }); // _handleError has either scheduled a retry or fired an event indicating failure. @@ -352,7 +352,7 @@ export default class Moderator extends Listenable { }) .catch(error => { logger.warn(`Error: ${error}`); - this._handleError(roomJid, undefined, undefined, resolve, reject); + this._handleError(roomJid, undefined, undefined, resolve, () => reject(error)); }); } }).then(() => { @@ -487,8 +487,7 @@ export default class Moderator extends Listenable { logger.error('Failed to get a successful response, giving up.'); // This is a "fatal" error and the user of the lib should handle it accordingly. - // TODO: change the event name to something accurate. - this.eventEmitter.emit(XMPPEvents.FOCUS_DISCONNECTED); + this.xmpp.eventEmitter.emit(CONNECTION_FAILED, CONFERENCE_REQUEST_FAILED); errorCallback(); }