From 71851d80758c76c0cbfe33ecb2e256f0f116bc6b Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Wed, 29 Sep 2021 19:00:14 -0400 Subject: [PATCH] Check error message for room publish failure Signed-off-by: Andrew Ferrazzutti --- src/createRoom.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/createRoom.ts b/src/createRoom.ts index 746fd63815..0d8172c558 100644 --- a/src/createRoom.ts +++ b/src/createRoom.ts @@ -222,7 +222,7 @@ export default async function createRoom(opts: IOpts): Promise { return client.createRoom(createOpts).finally(function() { if (modal) modal.close(); }).catch(function(err) { - if (err.httpStatus === 403 && err.errcode == "M_UNKNOWN") { + if (err.httpStatus === 403 && err.errcode === "M_UNKNOWN" && err.data.error === "Not allowed to publish room") { console.warn("Failed to publish room, try again without publishing it"); createOpts.visibility = Visibility.Private; return client.createRoom(createOpts);