From 349472ee68518ed99dd7c440cb9aff33ab75c8cd Mon Sep 17 00:00:00 2001 From: Ravi theja Date: Thu, 19 Oct 2023 14:11:44 +0530 Subject: [PATCH] fix: add error message for peerlist iterator --- packages/hms-video-web/src/sdk/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/hms-video-web/src/sdk/index.ts b/packages/hms-video-web/src/sdk/index.ts index d47a140845..cf4eabe0b8 100644 --- a/packages/hms-video-web/src/sdk/index.ts +++ b/packages/hms-video-web/src/sdk/index.ts @@ -220,6 +220,12 @@ export class HMSSdk implements HMSInterface { } getPeerListIterator(options?: HMSPeerListIteratorOptions) { + if (!this.transport || !this.store) { + throw ErrorFactory.GenericErrors.NotConnected( + HMSAction.VALIDATION, + `Ensure preview or join is called and room state is Preview or Connected before calling this`, + ); + } return new HMSPeerListIterator(this.transport, this.store, options); }