Skip to content

Commit

Permalink
rpc: recognize previous error code for ErrNotificationsUnsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Dec 8, 2022
1 parent 2301ca7 commit 4e95252
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions rpc/errors.go
Expand Up @@ -58,10 +58,12 @@ var (
)

const (
errcodeDefault = -32000
errcodeTimeout = -32002
errcodePanic = -32603
errcodeMarshalError = -32603
errcodeDefault = -32000
errcodeTimeout = -32002
errcodePanic = -32603
errcodeMarshalError = -32603

legacyErrcodeNotificationsUnsupported = -32001
)

const (
Expand Down Expand Up @@ -97,7 +99,11 @@ func (e notificationsUnsupportedError) Is(other error) bool {
return true
}
rpcErr, ok := other.(Error)
return ok && rpcErr.ErrorCode() == -32601
if ok {
code := rpcErr.ErrorCode()
return code == -32601 || code == legacyErrcodeNotificationsUnsupported
}
return false
}

type subscriptionNotFoundError struct{ namespace, subscription string }
Expand Down

0 comments on commit 4e95252

Please sign in to comment.