mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
extract app load error handler from app.js
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
343d4ea641
commit
0572d62c88
@ -151,7 +151,6 @@ 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');
|
||||
@ -167,17 +166,6 @@ export async function loadApp(fragParams: {}) {
|
||||
initialScreenAfterLogin={getScreenFromLocation(window.location)}
|
||||
defaultDeviceDisplayName={platform.getDefaultDeviceDisplayName()}
|
||||
/>;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
||||
let errorMessage = err.translatedMessage
|
||||
|| _t("Unexpected error preparing the app. See console for details.");
|
||||
errorMessage = <span>{errorMessage}</span>;
|
||||
|
||||
// Like the compatibility page, AWOOOOOGA at the user
|
||||
const GenericErrorPage = sdk.getComponent("structures.GenericErrorPage");
|
||||
return <GenericErrorPage message={errorMessage} title={_t("Your Riot is misconfigured")} />;
|
||||
}
|
||||
}
|
||||
|
||||
async function verifyServerConfig() {
|
||||
|
@ -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 => {
|
||||
|
Loading…
Reference in New Issue
Block a user