-
-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up code for handling decryption failures #4126
Conversation
This is unreachable with `crypto` unset. That's enforced by the types. If you call it with an unset `crypto`, you deserve a TypeError.
This should be more reliable, and more efficient, than checking the message type.
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.
Looks good; one question. Thanks!
@@ -211,12 +214,11 @@ export class DecryptionError extends Error { | |||
public readonly detailedString: string; | |||
|
|||
public constructor( | |||
public readonly code: string, |
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.
Is this a breaking change?
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.
Well first of all, this class (and indeed the whole file) is supposed to be internal, so anyone using it can keep both halves when it breaks.
In any case: It would only be a breaking change for things constructing a DecryptionError
: anything reading code
once it is created will implicitly cast the DecryptionFailureCode
to a string. And I've not been able to find any code constructing a DecryptionError
outside the js-sdk.
However, it turns out the removal of |
Once matrix-org/matrix-react-sdk#12364 lands, this should be good to go too. |
going to override the coverage gate on this |
Various improvements, including:
enum
for decryption failure reasonsEvent
Review commit-by-commit.