-
Notifications
You must be signed in to change notification settings - Fork 774
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
refactor(experimental): errors: assertions
package
#2188
refactor(experimental): errors: assertions
package
#2188
Conversation
assertions
package
e7fb883
to
325f801
Compare
1b48e25
to
91b4a68
Compare
325f801
to
ec6802f
Compare
91b4a68
to
2bf93b9
Compare
ec6802f
to
51680e6
Compare
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.
'Cryptographic operations are only allowed in secure browser contexts. Read more ' + | ||
'here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts', | ||
); | ||
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_MISSING); |
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.
I mean, as a corollary yes, but the actual error is SOLANA_ERROR__CRYPTO_DISALLOWED_IN_INSECURE_CONTEXT
or something.
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.
…like, SubtleCrypto
can be missing for other reasons, like the environment is otherwise ‘secure’ but just doesn't support SubtleCrypto
.
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.
I went for SOLANA_ERROR__SUBTLE_CRYPTO_DISALLOWED_IN_INSECURE_CONTEXT
in the feedback PR.
I also changes the _MISSING
suffixes with _UNIMPLEMENTED
as you suggested and added a description for it in the comments.
2bf93b9
to
b10a9e8
Compare
51680e6
to
37bdedc
Compare
b10a9e8
to
bb22886
Compare
37bdedc
to
2ae6db6
Compare
Merge activity
|
bb22886
to
16ce665
Compare
2ae6db6
to
54664fb
Compare
…tions (#2200) As mentioned in [this PR comment](#2188 (comment)), if you need to provide some kind of "reason" or "message" to an error, it's usually a smell. Now that we have custom error codes and can perform proper error handling, we can replace this mechanism for piping error messages (effectively "reasons") to fixed codec assertions! This change refactors out `message` from `assertIsFixed`. In a later commit, I'll replace the thrown error with a coded `SolanaError` and add the necessary `catch` statements downstream.
🎉 This PR is included in version 1.90.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
Adds custom
SolanaError
throws to the@solana/assertions
package.