Skip to content

Commit

Permalink
Return errors from any methods that try to do something specifically …
Browse files Browse the repository at this point in the history
…not supported by the HTTP client, leave nil return as implied/only-option type functions
  • Loading branch information
cmmarslender committed Mar 16, 2024
1 parent 7064263 commit 90ca974
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/httpclient/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,18 @@ func (c *HTTPClient) httpClientForService(service rpcinterface.ServiceType) (*ht

// SubscribeSelf does not apply to the HTTP Client
func (c *HTTPClient) SubscribeSelf() error {
return nil
return fmt.Errorf("subscriptions are not supported on the HTTP client - websockets are required for subscriptions")
}

// Subscribe does not apply to the HTTP Client
// Not applicable on the HTTP connection
func (c *HTTPClient) Subscribe(service string) error {
return nil
return fmt.Errorf("subscriptions are not supported on the HTTP client - websockets are required for subscriptions")
}

// AddHandler does not apply to HTTP Client
func (c *HTTPClient) AddHandler(handler rpcinterface.WebsocketResponseHandler) (uuid.UUID, error) {
return uuid.Nil, nil
return uuid.Nil, fmt.Errorf("handlers are not supported on the HTTP client - reponses are returned directly from the calling functions")
}

// RemoveHandler does not apply to HTTP Client
Expand All @@ -411,5 +411,5 @@ func (c *HTTPClient) SetSyncMode() error {

// SetAsyncMode does not apply to the HTTP Client
func (c *HTTPClient) SetAsyncMode() error {
return nil
return fmt.Errorf("async mode is not supported on the HTTP client")
}

0 comments on commit 90ca974

Please sign in to comment.