Replace newTranslatableError with UserFriendlyError (#25002)

* Apply user-friendly-error changes to element-web as well
* Update i18n library
pull/25029/head
Janne Mareike Koschinski 2023-03-31 12:41:15 +02:00 committed by GitHub
parent 1a63a7ff2e
commit 89054a50ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View File

@ -26,6 +26,9 @@
"contribute.json" "contribute.json"
], ],
"style": "bundle.css", "style": "bundle.css",
"matrix_i18n_extra_translation_funcs": [
"UserFriendlyError"
],
"scripts": { "scripts": {
"i18n": "matrix-gen-i18n", "i18n": "matrix-gen-i18n",
"prunei18n": "matrix-prune-i18n", "prunei18n": "matrix-prune-i18n",
@ -141,7 +144,7 @@
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"loader-utils": "^3.0.0", "loader-utils": "^3.0.0",
"matrix-mock-request": "^2.5.0", "matrix-mock-request": "^2.5.0",
"matrix-web-i18n": "^1.3.0", "matrix-web-i18n": "^1.4.0",
"mini-css-extract-plugin": "^1", "mini-css-extract-plugin": "^1",
"minimist": "^1.2.6", "minimist": "^1.2.6",
"mkdirp": "^2.0.0", "mkdirp": "^2.0.0",

View File

@ -23,7 +23,7 @@ import "matrix-js-sdk/src/browser-index";
import React, { ReactElement } from "react"; import React, { ReactElement } from "react";
import PlatformPeg from "matrix-react-sdk/src/PlatformPeg"; 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 AutoDiscoveryUtils from "matrix-react-sdk/src/utils/AutoDiscoveryUtils";
import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery"; import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery";
import * as Lifecycle from "matrix-react-sdk/src/Lifecycle"; import * as Lifecycle from "matrix-react-sdk/src/Lifecycle";
@ -168,16 +168,14 @@ async function verifyServerConfig(): Promise<IConfigOptions> {
const incompatibleOptions = [wkConfig, serverName, hsUrl].filter((i) => !!i); const incompatibleOptions = [wkConfig, serverName, hsUrl].filter((i) => !!i);
if (incompatibleOptions.length > 1) { if (incompatibleOptions.length > 1) {
// noinspection ExceptionCaughtLocallyJS // noinspection ExceptionCaughtLocallyJS
throw newTranslatableError( throw new UserFriendlyError(
_td( "Invalid configuration: can only specify one of default_server_config, default_server_name, " +
"Invalid configuration: can only specify one of default_server_config, default_server_name, " + "or default_hs_url.",
"or default_hs_url.",
),
); );
} }
if (incompatibleOptions.length < 1) { if (incompatibleOptions.length < 1) {
// noinspection ExceptionCaughtLocallyJS // noinspection ExceptionCaughtLocallyJS
throw newTranslatableError(_td("Invalid configuration: no default server specified.")); throw new UserFriendlyError("Invalid configuration: no default server specified.");
} }
if (hsUrl) { if (hsUrl) {

View File

@ -8167,10 +8167,10 @@ matrix-mock-request@^2.5.0:
what-input "^5.2.10" what-input "^5.2.10"
zxcvbn "^4.4.2" zxcvbn "^4.4.2"
matrix-web-i18n@^1.3.0: matrix-web-i18n@^1.4.0:
version "1.3.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/matrix-web-i18n/-/matrix-web-i18n-1.3.0.tgz#d85052635215173541f56ea1af0cbefd6e09ecb3" resolved "https://registry.yarnpkg.com/matrix-web-i18n/-/matrix-web-i18n-1.4.0.tgz#f383a3ebc29d3fd6eb137d38cc4c3198771cc073"
integrity sha512-4QumouFjd4//piyRCtkfr24kjMPHkzNQNz09B1oEX4W3d4gdd5F+lwErqcQrys7Yl09U0S0iKCD8xPBRV178qg== integrity sha512-+NP2h4zdft+2H/6oFQ0i2PBm00Ei6HpUHke8rklgpe/yCABBG5Q7gIQdZoxazi0DXWWtcvvIfgamPZmkg6oRwA==
dependencies: dependencies:
"@babel/parser" "^7.18.5" "@babel/parser" "^7.18.5"
"@babel/traverse" "^7.18.5" "@babel/traverse" "^7.18.5"