From 89054a50acb2251eed9ff24cb8053cd3b1d434d6 Mon Sep 17 00:00:00 2001 From: Janne Mareike Koschinski Date: Fri, 31 Mar 2023 12:41:15 +0200 Subject: [PATCH] Replace newTranslatableError with UserFriendlyError (#25002) * Apply user-friendly-error changes to element-web as well * Update i18n library --- package.json | 5 ++++- src/vector/app.tsx | 12 +++++------- yarn.lock | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 94ce2e9ef0..08572c4c67 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,9 @@ "contribute.json" ], "style": "bundle.css", + "matrix_i18n_extra_translation_funcs": [ + "UserFriendlyError" + ], "scripts": { "i18n": "matrix-gen-i18n", "prunei18n": "matrix-prune-i18n", @@ -141,7 +144,7 @@ "json-loader": "^0.5.7", "loader-utils": "^3.0.0", "matrix-mock-request": "^2.5.0", - "matrix-web-i18n": "^1.3.0", + "matrix-web-i18n": "^1.4.0", "mini-css-extract-plugin": "^1", "minimist": "^1.2.6", "mkdirp": "^2.0.0", diff --git a/src/vector/app.tsx b/src/vector/app.tsx index 5e0cec7f90..6614948abd 100644 --- a/src/vector/app.tsx +++ b/src/vector/app.tsx @@ -23,7 +23,7 @@ import "matrix-js-sdk/src/browser-index"; import React, { ReactElement } from "react"; import PlatformPeg from "matrix-react-sdk/src/PlatformPeg"; -import { _td, newTranslatableError } from "matrix-react-sdk/src/languageHandler"; +import { UserFriendlyError } from "matrix-react-sdk/src/languageHandler"; import AutoDiscoveryUtils from "matrix-react-sdk/src/utils/AutoDiscoveryUtils"; import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery"; import * as Lifecycle from "matrix-react-sdk/src/Lifecycle"; @@ -168,16 +168,14 @@ async function verifyServerConfig(): Promise { const incompatibleOptions = [wkConfig, serverName, hsUrl].filter((i) => !!i); if (incompatibleOptions.length > 1) { // noinspection ExceptionCaughtLocallyJS - throw newTranslatableError( - _td( - "Invalid configuration: can only specify one of default_server_config, default_server_name, " + - "or default_hs_url.", - ), + throw new UserFriendlyError( + "Invalid configuration: can only specify one of default_server_config, default_server_name, " + + "or default_hs_url.", ); } if (incompatibleOptions.length < 1) { // noinspection ExceptionCaughtLocallyJS - throw newTranslatableError(_td("Invalid configuration: no default server specified.")); + throw new UserFriendlyError("Invalid configuration: no default server specified."); } if (hsUrl) { diff --git a/yarn.lock b/yarn.lock index c1cf6f0822..deac1ddf28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8167,10 +8167,10 @@ matrix-mock-request@^2.5.0: what-input "^5.2.10" zxcvbn "^4.4.2" -matrix-web-i18n@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/matrix-web-i18n/-/matrix-web-i18n-1.3.0.tgz#d85052635215173541f56ea1af0cbefd6e09ecb3" - integrity sha512-4QumouFjd4//piyRCtkfr24kjMPHkzNQNz09B1oEX4W3d4gdd5F+lwErqcQrys7Yl09U0S0iKCD8xPBRV178qg== +matrix-web-i18n@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/matrix-web-i18n/-/matrix-web-i18n-1.4.0.tgz#f383a3ebc29d3fd6eb137d38cc4c3198771cc073" + integrity sha512-+NP2h4zdft+2H/6oFQ0i2PBm00Ei6HpUHke8rklgpe/yCABBG5Q7gIQdZoxazi0DXWWtcvvIfgamPZmkg6oRwA== dependencies: "@babel/parser" "^7.18.5" "@babel/traverse" "^7.18.5"