From 23a7394ce738f5057e9a055f055b7a3dac25ac71 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Mon, 9 Sep 2024 10:31:10 +1200 Subject: [PATCH] Catch bridge->hs connection errors --- scripts/seed.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/seed.js b/scripts/seed.js index dbb2cb57..ce5cfaf7 100644 --- a/scripts/seed.js +++ b/scripts/seed.js @@ -133,13 +133,15 @@ async function validateHomeserverOrigin(serverUrlPrompt, url) { let itWorks = false let lastError = null do { - const result = await api.ping() + const result = await api.ping().catch(e => ({ok: false, status: "net", root: e.message})) // If it didn't work, log details and retry after some time itWorks = result.ok if (!itWorks) { // Log the full error data if the error is different to last time if (!isDeepStrictEqual(lastError, result.root)) { - if (result.root.error) { + if (typeof result.root === "string") { + console.log(`\nCannot reach homeserver: ${result.root}`) + } else if (result.root.error) { console.log(`\nHomeserver said: [${result.status}] ${result.root.error}`) } else { console.log(`\nHomeserver said: [${result.status}] ${JSON.stringify(result.root)}`)