This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Replace newTranslatableError with UserFriendlyError (#10440#10440
Merged
Replace newTranslatableError with UserFriendlyError (#10440#10440
newTranslatableError with UserFriendlyError (#10440#10440Conversation
MadLittleMods
added a commit
to MadLittleMods/matrix-web-i18n
that referenced
this pull request
Mar 24, 2023
Needed for matrix-org/matrix-react-sdk#10440 ``` new UserFriendlyError("This email address is already in use" , { cause: err }); ```
MadLittleMods
added a commit
to matrix-org/matrix-web-i18n
that referenced
this pull request
Mar 24, 2023
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
MadLittleMods
commented
Mar 27, 2023
| `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 }, | ||
| ); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
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
MadLittleMods
commented
Mar 27, 2023
| import { MatrixClientPeg } from "./MatrixClientPeg"; | ||
| import dis from "./dispatcher/dispatcher"; | ||
| import { _t, _td, ITranslatableError, newTranslatableError } from "./languageHandler"; | ||
| import { _t, _td, UserFriendlyError } from "./languageHandler"; |
Contributor
Author
There was a problem hiding this comment.
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.
8 tasks
dbkr
approved these changes
Mar 28, 2023
MadLittleMods
commented
Mar 29, 2023
kerryarchibald
approved these changes
Mar 30, 2023
newTranslatableError with UserFriendlyErrornewTranslatableError with UserFriendlyError (#10440
Contributor
Author
|
Thank you @dbkr and @kerryarchibald for the review and @t3chguy for the merge 🐁 Thank you @justjanne for fixing up the downstream usage in |
MadLittleMods
added a commit
that referenced
this pull request
Apr 3, 2023
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
3 tasks
MadLittleMods
added a commit
that referenced
this pull request
Apr 4, 2023
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
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
causeand type nicenessPre-requisite for element-hq/element-web#9597
Todo
i18nincludes strings fromUserFriendlyErrornew Xexpressions 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.