-
Notifications
You must be signed in to change notification settings - Fork 911
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
Convert all errors in @solana/rpc-subscriptions-*
to coded exceptions
#2236
Convert all errors in @solana/rpc-subscriptions-*
to coded exceptions
#2236
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @steveluscher and the rest of your teammates on Graphite |
// TODO: Coded error. | ||
throw new Error('WebSocket connection closed', { cause: e }); | ||
throw new SolanaError(SOLANA_ERROR__RPC_WEBSOCKET_TRANSPORT_CONNECTION_CLOSED, { | ||
cause: e, |
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.
This is the reason for #2235.
4d5c576
to
041950e
Compare
packages/errors/src/codes.ts
Outdated
export const SOLANA_ERROR__RPC_WEBSOCKET_TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED = 56 as const; | ||
export const SOLANA_ERROR__RPC_WEBSOCKET_TRANSPORT_CONNECTION_CLOSED = 57 as const; | ||
export const SOLANA_ERROR__RPC_WEBSOCKET_TRANSPORT_FAILED_TO_CONNECT = 58 as const; |
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.
How would you feel about prefixing RPC Subscriptions errors with RPC_SUBSCRIPTIONS
and following the same convention as RPC_TRANSPORT_HTTP
— i.e. the concrete name of the transport come after the abstract name of the interface. Something like:
// Before.
SOLANA_ERROR__RPC_WEBSOCKET_TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED
SOLANA_ERROR__RPC_WEBSOCKET_TRANSPORT_CONNECTION_CLOSED
SOLANA_ERROR__RPC_WEBSOCKET_TRANSPORT_FAILED_TO_CONNECT
SOLANA_ERROR__SUBSCRIPTION_EXPECTED_SERVER_SUBSCRIPTION_ID
SOLANA_ERROR__SUBSCRIPTION_CANNOT_CREATE_SUBSCRIPTION_REQUEST
// After.
SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_WEBSOCKET_CLOSED_BEFORE_MESSAGE_BUFFERED
SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_WEBSOCKET_CONNECTION_CLOSED
SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_WEBSOCKET_FAILED_TO_CONNECT
SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID
SOLANA_ERROR__RPC_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST
I also think the first three should probably live under the subscription-related error codes. Unless I'm missing something.
e969a10
to
8516be1
Compare
041950e
to
72dde8f
Compare
Merge activity
|
72dde8f
to
70cdcb5
Compare
🎉 This PR is included in version 1.91.0 🎉 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. |
No description provided.