Skip to content

Commit

Permalink
fix: error handling when un/subscribe not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
John Sanders committed Oct 18, 2022
1 parent 0f134e6 commit 24d4fd7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/sessionControlClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,13 @@ class SessionControlClient extends EventEmitter {
return;
}

if (midGroupList[midGroup].subscribe === undefined) {
let err = new Error(`[Session Control Client] [Subscribe] subscribing to midGroup [${midGroup}] is not supported`);
debug("SessionControlClient _subscribe err_unsupported_midGroup");
cb(err);
return;
}

let mid = opts || {};

let type = SUBSCRIBE;
Expand Down Expand Up @@ -748,6 +755,13 @@ class SessionControlClient extends EventEmitter {
return;
}

if (midGroupList[midGroup].unsubscribe === undefined) {
let err = new Error(`[Session Control Client] [Unsubscribe] unsubscribing from midGroup [${midGroup}] is not supported`);
debug("SessionControlClient _unsubscribe err_unsupported_midGroup");
cb(err);
return;
}

if (cb === undefined) {
if (typeof opts === "function") {
cb = opts;
Expand Down

0 comments on commit 24d4fd7

Please sign in to comment.