Improve quality of Typescripting (#25232)

This commit is contained in:
Michael Telatynski 2023-05-05 09:08:36 +01:00 committed by GitHub
parent c0e070934a
commit 9e6467c684
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 8 deletions

View file

@ -19,6 +19,7 @@ limitations under the License.
*/
import { logger } from "matrix-js-sdk/src/logger";
import { extractErrorMessageFromError } from "matrix-react-sdk/src/components/views/dialogs/ErrorDialog";
// These are things that can run before the skin loads - be careful not to reference the react-sdk though.
import { parseQsFromFragment } from "./url_utils";
@ -194,7 +195,7 @@ async function start(): Promise<void> {
await loadConfigPromise;
} catch (error) {
// Now that we've loaded the theme (CSS), display the config syntax error if needed.
if (error.err && error.err instanceof SyntaxError) {
if (error instanceof SyntaxError) {
// This uses the default brand since the app config is unavailable.
return showError(_t("Your Element is misconfigured"), [
_t(
@ -202,7 +203,7 @@ async function start(): Promise<void> {
"Please correct the problem and reload the page.",
),
_t("The message from the parser is: %(message)s", {
message: error.err.message || _t("Invalid JSON"),
message: error.message || _t("Invalid JSON"),
}),
]);
}
@ -231,7 +232,7 @@ async function start(): Promise<void> {
// Like the compatibility page, AWOOOOOGA at the user
// This uses the default brand since the app config is unavailable.
await showError(_t("Your Element is misconfigured"), [
err.translatedMessage || _t("Unexpected error preparing the app. See console for details."),
extractErrorMessageFromError(err, _t("Unexpected error preparing the app. See console for details.")),
]);
}
}