Make slash command errors translatable but also work in rageshakes (#7377)
See https://github.com/matrix-org/matrix-react-sdk/pull/7372#discussion_r769556546 We want the error to be translated for the user but not in our rageshake logs. Also updates some error messages to give more info.
This commit is contained in:
parent
53a72dafa9
commit
038a6bc204
5 changed files with 91 additions and 40 deletions
|
@ -53,9 +53,9 @@ interface ITranslatableError extends Error {
|
|||
* @param {string} message Message to translate.
|
||||
* @returns {Error} The constructed error.
|
||||
*/
|
||||
export function newTranslatableError(message: string) {
|
||||
export function newTranslatableError(message: string, variables?: IVariables): ITranslatableError {
|
||||
const error = new Error(message) as ITranslatableError;
|
||||
error.translatedMessage = _t(message);
|
||||
error.translatedMessage = _t(message, variables);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue