From 229c584138a1928a3bb764293330a84aac3baad5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 25 Nov 2021 15:38:13 +0100 Subject: [PATCH 1/2] don't fail login if dehydrated devices are not supported --- src/matrix/SessionContainer.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index 3e3dab66..91418b0d 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -329,7 +329,16 @@ export class SessionContainer { request: this._platform.request, }); const olm = await this._olmPromise; - const encryptedDehydratedDevice = await getDehydratedDevice(hsApi, olm, this._platform, log); + let encryptedDehydratedDevice; + try { + encryptedDehydratedDevice = await getDehydratedDevice(hsApi, olm, this._platform, log); + } catch (err) { + if (err instanceof HomeServerError) { + log.set("not_supported", true); + } else { + throw err; + } + } if (encryptedDehydratedDevice) { let resolveStageFinish; const promiseStageFinish = new Promise(r => resolveStageFinish = r); From ae7d4d07dfbcbfbe82972594dad62bf571cb8757 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 25 Nov 2021 15:42:36 +0100 Subject: [PATCH 2/2] use .name so we don't need an import --- src/matrix/SessionContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index 91418b0d..d8977dde 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -333,7 +333,7 @@ export class SessionContainer { try { encryptedDehydratedDevice = await getDehydratedDevice(hsApi, olm, this._platform, log); } catch (err) { - if (err instanceof HomeServerError) { + if (err.name === "HomeServerError") { log.set("not_supported", true); } else { throw err;