element-web/test/components/views/settings
Eric Eastwood c1e7905ddc
Properly translate errors in AddThreepid.ts (#10432)
* Properly translate errors in AddThreepid.ts

Part of https://github.com/vector-im/element-web/issues/9597

* Use translated message

* Avoid returning undefined ever

* More usage

* Introduce UserFriendlyError

* Use UserFriendlyError

* Add more usage instead of normal error

* Use types and translatedMessage

* Fix lints

* Update i18n although it's wrong

* Use unknown for easier creation from try/catch

* Use types

* Use error types

* Use types

* Update i18n strings

* Remove generic re-label of HTTPError

See https://github.com/matrix-org/matrix-react-sdk/pull/10432#discussion_r1156468143

The HTTPError already has a good label and it isn't even translated if we re-label it here in this way generically

Probably best to just remove in favor of thinking about a translations in general from the `matrix-js-sdk`, see https://github.com/matrix-org/matrix-js-sdk/issues/1309

* Make error message extraction generic

* Update i18n strings

* Add tests for email addresses

* More consistent error logging to actually see error in logs

* Consistent error handling

* Any is okay because we have a fallback

* Check error type

* Use dedicated mockResolvedValue function

See https://github.com/matrix-org/matrix-react-sdk/pull/10432#discussion_r1163344034
2023-04-14 15:40:19 +01:00
..
__snapshots__ Improve accessibility of font slider (#10473) 2023-04-12 10:57:31 +00:00
devices Support for MSC3882 revision 1 (#10443) 2023-04-06 08:06:12 +00:00
discovery Properly translate errors in AddThreepid.ts (#10432) 2023-04-14 15:40:19 +01:00
shared Apply prettier formatting 2022-12-12 12:24:14 +01:00
tabs Simplify isDeviceVerified definitions (#10594) 2023-04-14 09:46:37 +00:00
AddPrivilegedUsers-test.tsx Apply prettier formatting 2022-12-12 12:24:14 +01:00
AvatarSetting-test.tsx Improve avatar settings accessibility (#9985) 2023-01-27 07:57:24 +00:00
CryptographyPanel-test.tsx Update usages of test utilities preferring RTL (#10203) 2023-02-22 10:52:55 +00:00
DevicesPanel-test.tsx Simplify isDeviceVerified definitions (#10594) 2023-04-14 09:46:37 +00:00
FontScalingPanel-test.tsx Improve accessibility of font slider (#10473) 2023-04-12 10:57:31 +00:00
KeyboardShortcut-test.tsx Conform more code to strict null checking (#10169) 2023-02-16 09:38:44 +00:00
Notifications-test.tsx Notifications: inline error message on notifications saving error (#10288) 2023-03-13 21:59:04 +00:00
SettingsFieldset-test.tsx Update usages of test utilities preferring RTL (#10203) 2023-02-22 10:52:55 +00:00
ThemeChoicePanel-test.tsx Apply prettier formatting 2022-12-12 12:24:14 +01:00