Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Replace newTranslatableError with UserFriendlyError (#10440 #10440

Merged
merged 17 commits into from
Mar 31, 2023

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Mar 24, 2023

Swapping out newTranslatableError('foo') where we lose error types with new 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 niceness

Pre-requisite for element-hq/element-web#9597

Todo

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • 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.

@MadLittleMods MadLittleMods added the T-Task Refactoring, enabling or disabling functionality, other engineering tasks label Mar 24, 2023
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
`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 },
);
}
Copy link
Contributor Author

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";
Copy link
Contributor Author

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.

@MadLittleMods MadLittleMods marked this pull request as ready for review March 27, 2023 19:50
@MadLittleMods MadLittleMods requested review from a team as code owners March 27, 2023 19:50
@t3chguy t3chguy changed the title Replace newTranslatableError with UserFriendlyError Replace newTranslatableError with UserFriendlyError (#10440 Mar 31, 2023
@t3chguy t3chguy merged commit ff1468b into develop Mar 31, 2023
@t3chguy t3chguy deleted the madlittlemods/user-friendly-error branch March 31, 2023 07:30
@MadLittleMods
Copy link
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 element-web element-hq/element-web#25002 🧐

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
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants