From 0572d62c88a899816098ce438698370dca2f8bac Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 9 Apr 2020 10:32:04 +0100 Subject: [PATCH] extract app load error handler from app.js Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/vector/app.js | 42 +++++++++++++++--------------------------- src/vector/index.ts | 7 ++++++- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/vector/app.js b/src/vector/app.js index 222a76a061..e92cdd2d63 100644 --- a/src/vector/app.js +++ b/src/vector/app.js @@ -151,33 +151,21 @@ export async function loadApp(fragParams: {}) { platform.startUpdater(); - try { - // Don't bother loading the app until the config is verified - const config = await verifyServerConfig(); - const MatrixChat = sdk.getComponent('structures.MatrixChat'); - return ; - } catch (err) { - console.error(err); - - let errorMessage = err.translatedMessage - || _t("Unexpected error preparing the app. See console for details."); - errorMessage = {errorMessage}; - - // Like the compatibility page, AWOOOOOGA at the user - const GenericErrorPage = sdk.getComponent("structures.GenericErrorPage"); - return ; - } + // Don't bother loading the app until the config is verified + const config = await verifyServerConfig(); + const MatrixChat = sdk.getComponent('structures.MatrixChat'); + return ; } async function verifyServerConfig() { diff --git a/src/vector/index.ts b/src/vector/index.ts index e018893f7b..1c89c4311c 100644 --- a/src/vector/index.ts +++ b/src/vector/index.ts @@ -21,6 +21,8 @@ limitations under the License. // Require common CSS here; this will make webpack process it into bundle.css. // Our own CSS (which is themed) is imported via separate webpack entry points // in webpack.config.js +import React from "react"; + require('gfm.css/gfm.css'); require('highlight.js/styles/github.css'); @@ -192,7 +194,10 @@ async function start() { await loadApp(fragparts.params); } catch (err) { console.error(err); - await showError(err); + // Like the compatibility page, AWOOOOOGA at the user + await showError(_t("Your Riot is misconfigured"), [ + err.translatedMessage || _t("Unexpected error preparing the app. See console for details."), + ]); } } start().catch(err => {