Skip to content

Commit

Permalink
fix: adjust to NewClient error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Aug 22, 2023
1 parent 7610a49 commit a50f3ff
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ import (
// FindServers returns the servers known to a server or discovery server.
func FindServers(ctx context.Context, endpoint string, opts ...Option) ([]*ua.ApplicationDescription, error) {
opts = append(opts, AutoReconnect(false))
c := NewClient(endpoint, opts...)
c, err := NewClient(endpoint, opts...)
if err != nil {
return nil, err
}
if err := c.Dial(ctx); err != nil {
return nil, err
}
Expand All @@ -45,7 +48,10 @@ func FindServers(ctx context.Context, endpoint string, opts ...Option) ([]*ua.Ap
// FindServersOnNetwork returns the servers known to a server or discovery server. Unlike FindServers, this service is only implemented by discovery servers.
func FindServersOnNetwork(ctx context.Context, endpoint string, opts ...Option) ([]*ua.ServerOnNetwork, error) {
opts = append(opts, AutoReconnect(false))
c := NewClient(endpoint, opts...)
c, err := NewClient(endpoint, opts...)
if err != nil {
return nil, err
}
if err := c.Dial(ctx); err != nil {
return nil, err
}
Expand Down

0 comments on commit a50f3ff

Please sign in to comment.