From 8625b403430a815007760403ca62106d785c2cfd Mon Sep 17 00:00:00 2001 From: "Stephane Lacoin (aka nxmatic)" Date: Fri, 5 Jul 2024 15:39:55 +0200 Subject: [PATCH] [loading] ensure desktop notified at popup loading error --- src/main/server-connector.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/server-connector.js b/src/main/server-connector.js index ff903b0..cb360c3 100644 --- a/src/main/server-connector.js +++ b/src/main/server-connector.js @@ -233,18 +233,18 @@ class ServerConnector extends ServiceWorkerComponent { asNuxeo() { return this.worker .tabNavigationHandler.asTabInfo() - .then((tabInfo) => this.nuxeoUrlOf(tabInfo.url)) - .then((nuxeoUrl) => { - if (nuxeoUrl === undefined) { - return undefined; + .then((tabInfo) => { + const serverUrl = this.nuxeoUrlOf(tabInfo.url); + if (serverUrl === undefined) { + throw new Error(`${tabInfo.url} not handled has a nuxeo URL, are you on the correct tab ?`); } - if (this.nuxeo && this.nuxeo._baseURL === nuxeoUrl.toString()) { + if (this.nuxeo && this.nuxeo._baseURL === serverUrl.toString()) { return this.nuxeo; } return this.connect(serverUrl, tabInfo) .then(() => { if (this.nuxeo === undefined) { - throw Error('Not connected to Nuxeo'); + throw new Error(`Cannot connect to ${serverUrl}`); } return this.nuxeo; })