-
-
Notifications
You must be signed in to change notification settings - Fork 829
Replace newTranslatableError
with UserFriendlyError
(#10440
#10440
Conversation
Needed for matrix-org/matrix-react-sdk#10440 ``` new UserFriendlyError("This email address is already in use" , { cause: err }); ```
Needed for matrix-org/matrix-react-sdk#10440 ``` new UserFriendlyError("This email address is already in use" , { cause: err }); ```
Conflicts: src/components/views/right_panel/UserInfo.tsx
Includes changes to find `new UserFriendlyError`, see matrix-org/matrix-web-i18n#6
`User (%(user)s) did not end up as invited to %(roomId)s but no error was given from the inviter utility`, | ||
{ user: member.userId, roomId, cause: undefined }, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remaining TS strict errors are unrelated and tracked by element-hq/element-web#24899
And there are some nits from files we didn't even change
@@ -30,7 +30,7 @@ import { SlashCommand as SlashCommandEvent } from "@matrix-org/analytics-events/ | |||
|
|||
import { MatrixClientPeg } from "./MatrixClientPeg"; | |||
import dis from "./dispatcher/dispatcher"; | |||
import { _t, _td, ITranslatableError, newTranslatableError } from "./languageHandler"; | |||
import { _t, _td, UserFriendlyError } from "./languageHandler"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SonarCloud coverage complaint and most is from this file, https://github.com/matrix-org/matrix-react-sdk/pull/10440/checks?check_run_id=12312160706
Adding test coverage here is pretty tangent to the this PR so I'm going to leave it as-is.
newTranslatableError
with UserFriendlyError
newTranslatableError
with UserFriendlyError
(#10440
Thank you @dbkr and @kerryarchibald for the review and @t3chguy for the merge 🐁 Thank you @justjanne for fixing up the downstream usage in |
Originally introduced in #8329 All usages were removed in #9605 This error also has problems with showing tranlsated versions in the logs. Part of element-hq/element-web#9597 We should be using the new `UserFriendlyError` for this kind of thing anyway. Introduced in #10440
Originally introduced in #8329 All usages were removed in #9605 This error also has problems with showing tranlsated versions in the logs. Part of element-hq/element-web#9597 We should be using the new `UserFriendlyError` for this kind of thing anyway. Introduced in #10440
Swapping out
newTranslatableError('foo')
where we lose error types withnew UserFriendlyError("This email address is already in use" , { cause: err });
where we can still get translations and maintain the underlying cause info and type semantics.Spawning from #10432 (comment) which has more usage if you're looking for something that actually uses the
cause
and type nicenessPre-requisite for element-hq/element-web#9597
Todo
i18n
includes strings fromUserFriendlyError
new X
expressions when looking for translation functions matrix-web-i18n#6Checklist
Sign-off given on the changes (see CONTRIBUTING.md)This change is marked as an internal change (Task), so will not be included in the changelog.