Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref(base/connection): conferenceFailed error argument
paweldomasa9ee5944e1a7
diff --git a/connection.js b/connection.jsindex f76e643573..f9614ff19d 100644--- a/connection.js+++ b/connection.js@@ -102,7 +102,12 @@ function connect(id, password, roomName) {/* eslint-enable max-params */APP.store.dispatch(connectionFailed(- connection, error, message, credentials, details));+ connection, {+ credentials,+ details,+ message,+ name: error+ }));if (isFatalJitsiConnectionError(error)) {connection.removeEventListener(diff --git a/react/features/authentication/actions.js b/react/features/authentication/actions.jsindex 0df6cace25..66af9a5a74 100644--- a/react/features/authentication/actions.js+++ b/react/features/authentication/actions.js@@ -4,6 +4,7 @@ import { appNavigate } from '../app';import { checkIfCanJoin, conferenceLeft } from '../base/conference';import { connectionFailed } from '../base/connection';import { openDialog } from '../base/dialog';+import { set } from '../base/redux';import {CANCEL_LOGIN,@@ -89,11 +90,7 @@ export function cancelLogin() {&& dispatch(connectionFailed(passwordRequired,- error && error.name,- error && error.message,- error && error.credentials,- error && error.details,- /* recoverable */ false));+ set(error, 'recoverable', false)));};}diff --git a/react/features/base/connection/actions.native.js b/react/features/base/connection/actions.native.jsindex 88284b526a..39d9f11a0c 100644--- a/react/features/base/connection/actions.native.js+++ b/react/features/base/connection/actions.native.js@@ -15,6 +15,53 @@ import {SET_LOCATION_URL} from './actionTypes';+/**+ * The error structure passed to the {@link connectionFailed} action.+ *+ * Note there was an intention to make the error resemble an Error instance (to+ * the extent that jitsi-meet needs it).+ */+export type ConnectionFailedError = {++ /**+ * The invalid credentials that were used to authenticate and the+ * authentication failed.+ */+ credentials?: {++ /**+ * The XMPP user's ID.+ */+ jid: string,++ /**+ * The XMPP user's password.+ */+ password: string+ },++ /**+ * The details about the connection failed event.+ */+ details?: string,++ /**+ * Error message.+ */+ message?: string,++ /**+ * One of {@link JitsiConnectionError} constants (defined in+ * lib-jitsi-meet).+ */+ name: string,++ /**+ * Indicates whether this event is recoverable or not.+ */+ recoverable?: boolean+}+/*** Opens new connection.*@@ -89,10 +136,18 @@ export function connect(id: ?string, password: ?string) {* @private* @returns {void}*/- function _onConnectionFailed(err, msg, credentials) {+ function _onConnectionFailed(+ err: string, msg: string, credentials: Object) {unsubscribe();console.error('CONNECTION FAILED:', err, msg);- dispatch(connectionFailed(connection, err, msg, credentials));+ dispatch(+ connectionFailed(+ connection, {+ credentials,+ name: err,+ message: msg+ }+ ));}/**@@ -167,54 +222,34 @@ export function connectionEstablished(connection: Object) {};}-/* eslint-disable max-params */-/*** Create an action for when the signaling connection could not be created.** @param {JitsiConnection} connection - The JitsiConnection which failed.- * @param {string} error - Error.- * @param {string} [message] - Error message.- * @param {Object} [credentials] - The invalid credentials that failed- * the authentication.- * @param {Object} [details] - The details about the connection failed event.- * @param {boolean} [recoverable] - Indicates whether this event is recoverable- * or not.+ * @param {ConnectionFailedError} error - Error.* @public* @returns {{* type: CONNECTION_FAILED,* connection: JitsiConnection,- * error: Object+ * error: ConnectionFailedError* }}*/export function connectionFailed(connection: Object,- error: string,- message: ?string,- credentials: ?Object,- details: ?Object,- recoverable: ?boolean) {+ error: ConnectionFailedError) {+ const { credentials } = error;++ if (credentials && !Object.keys(credentials).length) {+ error.credentials = undefined;+ }+return {type: CONNECTION_FAILED,connection,-- // Make the error resemble an Error instance (to the extent that- // jitsi-meet needs it).- error: {- credentials:- credentials && Object.keys(credentials).length- ? credentials- : undefined,- message,- name: error,- details,- recoverable- }+ error};}-/* eslint-enable max-params */-/*** Constructs options to be passed to the constructor of {@code JitsiConnection}* based on the redux state.diff --git a/react/features/base/connection/reducer.js b/react/features/base/connection/reducer.jsindex 587eee458a..fd50bd0337 100644--- a/react/features/base/connection/reducer.js+++ b/react/features/base/connection/reducer.js@@ -13,6 +13,8 @@ import {SET_LOCATION_URL} from './actionTypes';+import type { ConnectionFailedError } from './actions.native';+/*** Reduces the Redux actions of the feature base/connection.*/@@ -100,7 +102,7 @@ function _connectionFailed(state: Object,{ connection, error }: {connection: Object,- error: Object | string+ error: ConnectionFailedError}) {// The current (similar to getCurrentConference in