diff --git a/src/constants.js b/src/constants.js index 2e248cd..ee5d1ce 100644 --- a/src/constants.js +++ b/src/constants.js @@ -109,6 +109,7 @@ const ZITI_CONSTANTS = 'ZITI_EVENT_NESTED_TLS_HANDSHAKE_TIMEOUT': 'nestedTLSHandshakeTimeout', 'ZITI_EVENT_NO_CONFIG_PROTOCOL_FOR_SERVICE': 'noConfigProtocolForServiceEvent', 'ZITI_EVENT_WSS_ROUTER_CONNECTION_ERROR': 'WSSEnabledEdgeRouterConnectionErrorEvent', + 'ZITI_EVENT_CONTROLLER_CONNECTION_ERROR': 'ControllerConnectionErrorEvent', /** * Name of event indicating encrypted data for a nestedTLS connection has arrived and needs decryption diff --git a/src/context/context.js b/src/context/context.js index 0b396c9..a4d9a86 100644 --- a/src/context/context.js +++ b/src/context/context.js @@ -1095,8 +1095,14 @@ class ZitiContext extends EventEmitter { */ async listControllerVersion() { + let self = this; + let res = await this._zitiBrowzerEdgeClient.listVersion({ }).catch((error) => { + // Let listeners know we failed to connect to the Controller + self.emit(ZITI_CONSTANTS.ZITI_EVENT_CONTROLLER_CONNECTION_ERROR, { + controllerApi: self.controllerApi, + }); throw error; });