From a50f3ff43a9c2a92cb5154d3a92ecf01fbb4d5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Tue, 22 Aug 2023 13:19:11 +0200 Subject: [PATCH] fix: adjust to NewClient error handling --- client.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 077796a4..9dfe0777 100644 --- a/client.go +++ b/client.go @@ -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 } @@ -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 }