Skip to content

Commit

Permalink
rpc: document errors.Is(..., ErrNotificationsUnsupported) better
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Jun 14, 2023
1 parent 7146379 commit 406506c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rpc/subscription.go
Expand Up @@ -32,7 +32,15 @@ import (
)

var (
// ErrNotificationsUnsupported is returned when the connection doesn't support notifications
// ErrNotificationsUnsupported is returned by the client when the connection doesn't
// support notifications. You can use this error value to check for subscription
// support like this:
//
// sub, err := client.EthSubscribe(ctx, channel, "newHeads", true)
// if errors.Is(err, rpc.ErrNotificationsUnsupported) {
// // Server does not support subscriptions, fall back to polling.
// }
//
ErrNotificationsUnsupported = notificationsUnsupportedError{}

// ErrSubscriptionNotFound is returned when the notification for the given id is not found
Expand Down

0 comments on commit 406506c

Please sign in to comment.